在表格显示中,字段值过长使用省略号,tooltip显示全部,但是不方便复制,搜索后找到方法:
function copy(data) {
const copyIpt = document.createElement('input')
copyIpt.value = data
document.body.appendChild(copyIpt)
copyIpt.select() // 选中
document.execCommand('copy') // 执行复制
document.body.removeChild(copyIpt) // 移除输入框
}