复制到剪贴板会提示
navigator.clipboard is undefined
解决
copyText(text) {
const input = document.createElement('input');
input.value = text; // 设置要复制的文本
input.style.position = 'absolute';
input.style.left = '-9999px';
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
this.$message.success("复制成功")
},
然后在需要的地方使用即可
以上答案为AI给出的答案,在这里记录一下,以备后续使用