fix:修改原生复制function为插件复制

This commit is contained in:
likexuan
2022-11-02 14:53:10 +08:00
parent 3b7b673d52
commit 90d58ae8ce
2 changed files with 15 additions and 18 deletions

View File

@@ -161,15 +161,9 @@ export default {
deviceTag: item.deviceTag || '', deviceTag: item.deviceTag || '',
params: item.params || '' params: item.params || ''
} }
const domUrl = document.createElement('input') this.$copyText(JSON.stringify(str)).then(() => {
domUrl.value = JSON.stringify(str) this.$message.success({ message: this.$t('overall.copySuccess') })
domUrl.id = 'creatDom' })
document.body.appendChild(domUrl)
domUrl.select() // 选择对象
document.execCommand('Copy') // 执行浏览器复制命令
const creatDom = document.getElementById('creatDom')
creatDom.parentNode.removeChild(creatDom)
this.$message.success(this.$t('overall.copySuccess'))
}, },
// 数据排序 // 数据排序
tableDataSort (item) { tableDataSort (item) {

View File

@@ -312,15 +312,18 @@ export default {
methods: { methods: {
copyValue (item) { copyValue (item) {
const str = item const str = item
const domUrl = document.createElement('input') // const domUrl = document.createElement('input')
domUrl.value = JSON.stringify(str) // domUrl.value = JSON.stringify(str)
domUrl.id = 'creatDom' // domUrl.id = 'creatDom'
document.body.appendChild(domUrl) // document.body.appendChild(domUrl)
domUrl.select() // 选择对象 // domUrl.select() // 选择对象
document.execCommand('Copy') // 执行浏览器复制命令 // document.execCommand('Copy') // 执行浏览器复制命令
const creatDom = document.getElementById('creatDom') // const creatDom = document.getElementById('creatDom')
creatDom.parentNode.removeChild(creatDom) // creatDom.parentNode.removeChild(creatDom)
this.$message.success(this.$t('overall.copySuccess')) // this.$message.success(this.$t('overall.copySuccess'))
this.$copyText(JSON.stringify(str)).then(() => {
this.$message.success({ message: this.$t('overall.copySuccess') })
})
}, },
suspendedStr (status) { // 10进制转为2进制 分别给对应的状态 suspendedStr (status) { // 10进制转为2进制 分别给对应的状态
if (!status || status === 1 || status == 0) { return '' } if (!status || status === 1 || status == 0) { return '' }