原生js 复制功能

 function  handleCopy(){
    const range = document.createRange(); 
      range.selectNode(document.getElementById('echo_url')); 
      const selection = window.getSelection();  
      if (selection.rangeCount > 0) selection.removeAllRanges();
      selection.addRange(range); 
      document.execCommand('copy'); 
      selection.removeRange(range); 
  }

你可能感兴趣的:(技术,javascript,前端,开发语言)