点击复制,就可以实现copy
{{fenxiao.appSecret}}
复制
copyAppSecret() {
let createInput = document.createElement("input");
createInput.value = this.fenxiao.appSecret;
document.body.appendChild(createInput);
createInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
createInput.style.display = "none";
this.$message({ message: "复制成功", type: "success" });
},
网上说的那种
let tt=document.getElementById("xxxx")
tt.select(); // 选择对象
原文:https://www.cnblogs.com/myfirstboke/p/10469584.html