vue achieve copy function

vue achieve copy function

Copy () {
  var _Input = document.createElement ( "INPUT"); // build directly INPUT
  _input.value = this.egc_token; // set content
  document.body.appendChild (_input); // add temporary instance
  _input.select (); // select examples of content
  document.execCommand ( "copy"); // perform replication
  alert ( 'copied successfully')
  document.body.removeChild (_Input); // delete temporary instance
}
 

 

Guess you like

Origin www.cnblogs.com/Strangers/p/11949645.html