简单点击复制内容

copy(data) {
      const input = document.createElement('input')
      document.body.appendChild(input)
      input.setAttribute('value', data)
      input.select()
      if (document.execCommand('copy')) {
        document.execCommand('copy')
        this.$message({
          showClose: true,
          message: '复制成功',
          type: 'success'
        })
      }
      document.body.removeChild(input)
    }
原文地址:https://www.cnblogs.com/tangyuqi/p/15194339.html