美文网首页WEB前端笔记本
复制按钮复制文本内容

复制按钮复制文本内容

作者: 蜗牛和曼巴 | 来源:发表于2020-02-24 10:02 被阅读0次
 handlCopy() {
      const input = document.createElement('input')
      document.body.appendChild(input)
      input.setAttribute('value', this.formInformation.productPublicKey)   //内容
      input.select()
      if (document.execCommand('copy')) {
        document.execCommand('copy')
      }
      document.body.removeChild(input)
      this.$message({
        message: '复制成功',
        type: 'success'
      })
    },

相关文章

网友评论

    本文标题:复制按钮复制文本内容

    本文链接:https://www.haomeiwen.com/subject/qskmqhtx.html