记录一下点击复制功能的实现代码
copy(){
copyText = '测试';
const input = document.createElement('textarea');
document.body.appendChild(input);
input.innerHTML = copyText;
input.setAttribute('code',1);
input.select();
document.execCommand("Copy");
var list = document.getElementsByTagName('textarea');
var inputList = Array.prototype.slice.call(list);
inputList.forEach((item)=>{
if(item.getAttribute('code'))document.body.removeChild(item);
});
},