如何复制链接到剪贴板上?

 copyLink (item) {
      let tempStr = item.pageurl
      let copyText = document.createElement('textarea')
      copyText.style.position = 'absolute'
      copyText.style.left = '-9999px'
      copyText.innerHTML = tempStr
      copyText.readOnly = false
      document.body.appendChild(copyText)
      copyText.select()
      copyText.setSelectionRange(0, copyText.value.length)
      document.execCommand('copy')
      copyText.readOnly = true
      this.$message.success('链接已复制到剪切板')
 },

猜你喜欢

转载自blog.csdn.net/weixin_43844696/article/details/110647096
今日推荐