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

The click event of the dropdown-button in the layout will be triggered twice #5002

Closed
1 task
jiagang opened this issue Dec 9, 2021 · 7 comments
Closed
1 task

Comments

@jiagang
Copy link

jiagang commented Dec 9, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.0.0-alpha.14

Environment

win10、chrome96、vue3.2.24

Reproduction link

Edit on CodeSandbox

Steps to reproduce

layout 中出现 layout-sider 时

What is expected?

按钮的点击事件应该只触发一次

What is actually happening?

dropdown-button的点击事件会触发两次


普通button是正常的,layout中不出现layout-sider时也是正常的

@github-actions github-actions bot changed the title 在layout中的dropdown-button的点击事件会触发两次 The click event of the dropdown-button in the layout will be triggered twice Dec 9, 2021
@24min
Copy link
Contributor

24min commented Dec 10, 2021

阻止冒泡事件【e.stopPropagation()】对此issue似乎可行,

业务组件中:
dd5bc5a3a0bf807d78e7275bebc2bf6

或者
components\dropdown\dropdown-button.tsx
1e008d6220addd39e6465feac7bbfee

另外,我发现在有layout-sider时候,点击dropdown右边的按钮,也会触发click事件,所以需要在components\dropdown\dropdown-button.tsx中再给右边的按钮也阻止掉冒泡事件。

阻止冒泡虽然能解决这个触发两次的问题,但具体触发此问题的原因,还不明确。

@tangjinzhou
Copy link
Member

感觉是 vue 的bug

@tangjinzhou
Copy link
Member

不是冒泡的问题

tangjinzhou added a commit that referenced this issue Dec 11, 2021
本质原因应该还是 vue 问题,有待进一步定位
@24min
Copy link
Contributor

24min commented Dec 12, 2021

不是冒泡的问题

组止冒泡的话是一个治标不治本的改法。但是具体为啥会有这个问题,水平有限,无法找到😕

@jiagang
Copy link
Author

jiagang commented Dec 13, 2021

是很奇怪,我发现绑定事件改成这样就正常了
image

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants