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

a-typography-link specifies the copyable attribute, limiting the self event of the copy button to not be thrown #5746

Closed
1 task
atom-git opened this issue Jun 24, 2022 · 5 comments
Labels

Comments

@atom-git
Copy link
Contributor

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

What problem does this feature solve?

例如<a-typography-link @click="handleLinked" underline copyable>中,点击copy按钮,click事件也会被响应,有可能会需要两种动作

What does the proposed API look like?

copyable时,copy按钮 onclick中增加stop阻止冒泡

@github-actions github-actions bot changed the title a-typography-link 指定了copyable属性,限定copy按钮self事件不抛出 a-typography-link specifies the copyable attribute, limiting the self event of the copy button to not be thrown Jun 24, 2022
@tangjinzhou
Copy link
Member

使用 copyableIcon 插槽自定义 copy icon 就可以了

@atom-git
Copy link
Contributor Author

使用 copyableIcon 插槽自定义 copy icon 就可以了

https://codesandbox.io/s/wen-ben-yu-chao-lian-jie-zu-jian-ant-design-vue-3-2-7-forked-6g751e?file=/src/demo.vue
亲,麻烦看下,按照您的说法,还是一样的,点击copy按钮,绑定在a-typography-link中的动作也生效了

@tangjinzhou
Copy link
Member

<template #copyableIcon="{ copied }">
        <span @click.stop>
        <CopyOutlined v-if="!copied" />
        <CheckOutlined v-else style="color: blue" />
        </span>
      </template>

自定义 stop 啊

@atom-git
Copy link
Contributor Author

<template #copyableIcon="{ copied }">
        <span @click.stop>
        <CopyOutlined v-if="!copied" />
        <CheckOutlined v-else style="color: blue" />
        </span>
      </template>

自定义 stop 啊

场景是,通过link展示一个链接文本,后面提供复制长文本的能力,同时点击链接时又能够自定义响应动作,两个动作是分离的,这里stop后,copy默认动作也丢失了。

tangjinzhou added a commit that referenced this issue Sep 1, 2022
* 分离copyable按钮动作,不再冒泡至父级组件

* Update interactive.vue

Co-authored-by: tangjinzhou <415800467@qq.com>
@github-actions
Copy link

github-actions bot commented Jul 2, 2023

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 Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants