You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
489 B
19 lines
489 B
![]()
1 week ago
|
import modernCopyToClipboard from '@/utils/clipboard';
|
||
|
|
||
|
export default {
|
||
|
install(Vue) {
|
||
|
Vue.directive('clipboard', {
|
||
|
bind(el, binding) {
|
||
|
el.style.cursor = 'pointer';
|
||
|
el.addEventListener('click', async () => {
|
||
|
const text = binding.value || el.innerText;
|
||
|
const options = {
|
||
|
vm: binding.instance,
|
||
|
...(binding.arg || {})
|
||
|
};
|
||
|
await modernCopyToClipboard(text, options);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
};
|