WEB前端笔记本

复制按钮复制文本内容

2020-02-24  本文已影响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'
      })
    },
上一篇下一篇

猜你喜欢

热点阅读