前端Vue知识点2(文本复制)

it2024-04-21  59

vue文本复制

vue打包成app后也是生效的

<button class="btnt" @click="copyText(url)">复制推广链接</button> copyText(shareLink) { var input = document.createElement("input"); input.value = shareLink; document.body.appendChild(input); input.select(); document.execCommand("Copy"); document.body.removeChild(input); console.log('复制成功') },
最新回复(0)