<button @click="copyUrl">复制url</button>   

  

//js
    copyUrl() {
      const input = document.createElement('input')
      document.body.appendChild(input)
      input.setAttribute('value',"这里可以写变量或者要复制的字符串内容")
      input.select()
      if (document.execCommand('copy')) {
        document.execCommand('copy')
      }
      document.body.removeChild(input)

  

相关文章:

  • 2021-11-13
  • 2021-11-23
  • 2021-11-30
  • 2021-10-14
  • 2018-08-31
  • 2021-11-13
  • 2021-10-01
  • 2021-11-23
猜你喜欢
  • 2021-08-30
  • 2021-12-03
  • 2021-12-10
  • 2021-11-04
  • 2021-12-03
  • 2021-11-02
  • 2021-11-23
  • 2021-12-03
相关资源
相似解决方案