copyEvent () {
var textArea = document.createElement('textarea')
document.body.appendChild(textArea)
textArea.readOnly = 'readonly'
textArea.style.opacity = '0'
textArea.value = this.url //你的要被复制的链接
textArea.select()
if (textArea.setSelectionRange)
textArea.setSelectionRange(0, textArea.value.length)
else
textArea.select()
document.execCommand("copy")
this.$message({
message: '链接已成功复制到剪贴板',
type: 'success'
})
document.body.removeChild(textArea)
}
vue复制到剪贴板
最新推荐文章于 2024-05-30 08:42:49 发布