先在网页中插入input框并隐藏
<input type
="button" hidden value
="点击复制代码" />
<button @click
="goOpen" type
="primary">复制
</button
>
再在写入点击方法,点击后即可复制成功
public goOpen(): void {
var Url
= '123213123'
var oInput
= document
.createElement('input')
oInput
.value
= Url
document
.body
.appendChild(oInput
)
oInput
.select()
document
.execCommand('Copy')
alert('复制成功')
}
转载请注明原文地址: https://lol.8miu.com/read-38090.html