copyTextToClipboard() {
//console.log(text)
let textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
let successful = document.execCommand('copy');
if (successful == true) {
//console.log("复制输入框的值",textArea.value)
this.$message.success("复制成功!");
} else {
this.$message.success("该浏览器不支持点击复制到剪贴板");
}
} catch (err) {
alert('该浏览器不支持点击复制到剪贴板');
}
document.body.removeChild(textArea);
},
网友评论