Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Component] [button] el-button按钮,当设置tag="a"的时候 disabled无效 #16591

Closed
136323000 opened this issue Apr 20, 2024 · 6 comments
Closed

Comments

@136323000
Copy link

Bug Type: Component

Environment

  • Vue Version: 3.4.21
  • Element Plus Version: 2.7.0
  • Browser / OS: Windows
  • Build Tool: Vite

Reproduction

Related Component

  • el-button

Reproduction Link

Element Plus Playground

Steps to reproduce

test

What is Expected?

当设置:disabled=true的时候 无法点击跳转

What is actually happening?

实际可以点击跳转

Additional comments

(empty)

@warmthsea
Copy link
Contributor

image
建议直接手动解决

@btea
Copy link
Collaborator

btea commented Apr 20, 2024

This is normal behavior. In fact, a tag does not support disabled. If you need this effect, please handle it yourself as @warmthsea suggested.

@chenxch
Copy link
Member

chenxch commented Apr 22, 2024

是否可以考虑是在a标签的时候使用pointer-events在实现禁用功能

@wangdaodao
Copy link

是否可以考虑是在a标签的时候使用pointer-events在实现禁用功能

pointer-events也不是最佳实践,用户可以通过控制面板去掉样式。这块假如是a标签,是可以预先知道的,手动解决就行。

@chenxch
Copy link
Member

chenxch commented Apr 22, 2024

是否可以考虑是在a标签的时候使用pointer-events在实现禁用功能

pointer-events也不是最佳实践,用户可以通过控制面板去掉样式。这块假如是a标签,是可以预先知道的,手动解决就行。

是的,这只是hack的一个方案想法,对于大部分用户来说,普遍认为就只要设置了disabled点击事件不要触发。我相信这种场景来问问题的用户肯定不在少数,或许可以在文档中说明,disabled在tag=a时候无效。

@136323000
Copy link
Author

图像 建议直接手动解决

成功解决了我的问题 感谢

@chenxch chenxch closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants