rodro1

Vue copy click event

Jul 2nd, 2021 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. copyText(str){
  2.  
  3. const el = document.createElement('textarea');
  4. el.value = str;
  5. el.setAttribute('readonly', '');
  6. el.style.position = 'absolute';
  7. el.style.left = '-9999px';
  8. document.body.appendChild(el);
  9. el.select();
  10. document.execCommand('copy');
  11. document.body.removeChild(el);
  12.  
  13. alert('wechat id copied successfully')
  14. // navigator.clipboard.writeText(copyText);
  15. // alert('wechat id copied successfully')
  16. },
Add Comment
Please, Sign In to add comment