const textarea = document.createElement('textarea') as any;
textarea.readOnly = 'readonly';
textarea.style.position = 'absolute';
textarea.style.left = '-9999px';
// 将要 copy 的值赋给 textarea 标签的 value 属性
textarea.value = this.data.pdf;
// 将 textarea 插入到 body 中
document.body.appendChild(textarea);
// 选中值并复制
textarea.select();
textarea.setSelectionRange(0, textarea.value.length);
const result = document.execCommand('Copy');
if (result) {
  this.$message.success('链接复制成功')
}
document.body.removeChild(textarea);

就你叫洛
21 声望0 粉丝

« 上一篇
导入文件
下一篇 »
ajax-hook 使用