span等非输入控件一键复制:
sqlCopy () {
const input = document.createElement('input')
input.setAttribute('readonly', 'readonly')
input.setAttribute('value', this.data)
document.body.appendChild(input)
input.select()
if (document.execCommand('copy')) {
this.$message({
message: '复制成功!',
type: 'success'
})
}
document.body.removeChild(input)
}