// 复制到剪切板
const copy = (val) => {
const input = document.createElement('input')
input.setAttribute('readonly', 'readonly')
input.setAttribute('value', val)
// input.value = val
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length)
if (document.execCommand('copy')) {
document.execCommand('copy')
Toast('复制成功 :' + val)
}
document.body.removeChild(input)
}
js复制到剪切板
猜你喜欢
转载自blog.csdn.net/sank2017/article/details/104006314
今日推荐
周排行