5201314m

通过点击 复制 按钮复制对应的内容,然后Ctrl+v实现粘贴。

 

实现效果:

 

实现代码:

1.html:

<el-button @click="clickCopy(item)">复制</el-button>

2.js方法:

//点击复制
clickCopy(item){
  let url = item.transactionid;
  let oInput = document.createElement(\'input\');
  oInput.value = url;
  document.body.appendChild(oInput);
  oInput.select(); // 选择对象;
  document.execCommand("Copy"); // 执行浏览器复制命令
  this.$message({
    message: \'复制成功\',
    type: \'success\'
  });
  oInput.remove();
},

 

这样就可以实现复制id,在任何地方粘贴了。

分类:

技术点:

相关文章:

  • 2021-12-03
  • 2021-12-16
  • 2022-01-22
  • 2021-12-13
  • 2021-11-13
  • 2021-08-30
  • 2021-10-12
  • 2021-12-10
猜你喜欢
  • 2021-12-03
  • 2021-12-19
  • 2021-12-03
  • 2021-09-28
  • 2021-10-14
  • 2021-10-18
  • 2021-12-02
相关资源
相似解决方案