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

tag标签绑定click事件时,点击tag标签的关闭按钮时会同时触发close事件 #3343

Closed
maddenBoy opened this issue Jul 26, 2022 · 4 comments · Fixed by #3352
Closed
Labels
feature request New feature or request

Comments

@maddenBoy
Copy link

maddenBoy commented Jul 26, 2022

TuSimple/naive-ui version (版本)

2.31.0

Vue version (Vue 版本)

3.2.37

Browser and its version (浏览器及其版本)

Chrome(103.0.5060.134)

System and its version (系统及其版本)

window 11

Node version (Node 版本)

Reappearance link (重现链接)

https://www.naiveui.com/zh-CN/light/components/tag

Reappearance steps (重现步骤)

给可关闭的tag标签绑定click事件,点击关闭按钮时会同时触发两个事件

Expected results (期望的结果)

期望给可关闭的tag标签绑定click事件时,点击非关闭按钮区域时只触发click事件,点击关闭按钮时只触发close事件。

Actual results (实际的结果)

实际给可关闭的tag标签绑定click事件时,点击关闭按钮时会同时触发click事件和close事件。

Remarks (补充说明)

elementui的tag有click和close两个回调,naive只有close的回调

@github-actions github-actions bot added the untriaged need to sort label Jul 26, 2022
@Sepush
Copy link
Collaborator

Sepush commented Jul 26, 2022

use internal-stop-click-propagation prop can solve your issue.

<n-tag 
  type="info" 
  closable 
  internal-stop-click-propagation 
  @click="handleClick" @close="handleClose"
>
  OK
</n-tag>

@Sepush Sepush closed this as completed Jul 26, 2022
@07akioni
Copy link
Collaborator

这个可能得考虑

@07akioni 07akioni reopened this Jul 26, 2022
@07akioni
Copy link
Collaborator

外部化这种属性

@07akioni 07akioni added feature request New feature or request and removed untriaged need to sort labels Jul 26, 2022
@Sepush
Copy link
Collaborator

Sepush commented Jul 26, 2022

外部化这种属性

暴露出来叫 stopClickPropagation 怎么样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants