We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0e93bf commit ac84961Copy full SHA for ac84961
src/plugins/directives.ts
@@ -7,6 +7,9 @@ import { ElMessage } from 'element-plus';
7
export default function (app: any): void {
8
app.directive('copy', {
9
/* ... */
10
+ updated(el: HTMLElement, binding: any): void {
11
+ el.setAttribute('data-clipboard-text', binding.value);
12
+ },
13
mounted(el: HTMLElement, binding: any): void {
14
el.setAttribute('data-clipboard-text', binding.value);
15
let clipboard: any;
@@ -31,7 +34,7 @@ export default function (app: any): void {
31
34
//解决clipboard第一次点击不生效问题,那就在enter时实例化Clipboard
32
35
el.addEventListener('mouseenter', () => {
33
36
clipboard = new Clipboard(el, {
- text: () => binding.value,
37
+ text: () => el.getAttribute('data-clipboard-text'),
38
});
39
40
},
0 commit comments