function copyStr(val) { //val 是要复制的字符串
      var input = document.createElement("input");
      input.value = val;
      input.readOnly = true
      document.body.appendChild(input);
      input.select();
      input.setSelectionRange(0, input.value.length)
      document.execCommand('Copy');
      document.body.removeChild(input);
      window.scrollTo(0, 0)
      alert('复制成功')
    }

 

相关文章:

  • 2021-12-21
  • 2021-11-29
  • 2021-11-29
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
相关资源
相似解决方案