1.html
<span class="urlSpan" id="copyCode">{{ url }}</span>
<a-button size="small" ghost type="primary" @click="copyText">复制链接</a-button>
2.js
//复制链接
copyText(val) {
let copyInput = document.createElement("input"); // 创建标签
copyInput.value = val; // 标签赋值
document.body.appendChild(copyInput); // 添加标签
copyInput.select(); // 选取文本框内容
document.execCommand("copy"); // 调用浏览器复制
document.body.removeChild(copyInput); // 复制成功后再将构造的标签 移除
},