实现一键复制

// 一键复制
copyText() {
    
    
  const transfer = document.createElement('input')
  document.body.appendChild(transfer)
  transfer.value = '账号:' + this.currentNum + ' 密码:' + this.currentPwd
  transfer.focus()
  transfer.select()
  if (document.execCommand('copy')) {
    
    
    document.execCommand('copy')
  }
  transfer.blur()
  this.$message.success('复制成功')
  document.body.removeChild(transfer)
},

猜你喜欢

转载自blog.csdn.net/weixin_40639095/article/details/120350619