[Vuejs]-How can I create a copy button directly from same button Vuejs

0👍

No need to pass data to the function, try something like below

methods: {
  copyUrl() {
   var cpLink = window.location.href;
   cpLink.select();
   try {
    var successful = document.execCommand('copy');
    var msg = successful ? 'successful' : 'unsuccessful';
    console.log('Copy command was ' + msg);
   } catch (err) {
     console.log('Oops, unable to copy');
   }
   event.preventDefault; 
 }
}

Leave a comment