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

This commit is contained in:
zhangyu
2022-11-02 14:38:28 +08:00
parent 95cd8f9b6f
commit cade42788c
4 changed files with 12 additions and 36 deletions

View File

@@ -392,15 +392,9 @@ export default {
element.click() element.click()
}, },
copyValue () { copyValue () {
const domUrl = document.createElement('input') this.$copyText(this.fileContent).then(() => {
domUrl.value = this.fileContent 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'))
}, },
initEvent () { initEvent () {
bus.$on('profile-dialog', () => { bus.$on('profile-dialog', () => {

View File

@@ -1439,15 +1439,9 @@ export default {
}, },
copyValue () { copyValue () {
const domUrl = document.createElement('input') this.$copyText(this.configsCopyValue).then(() => {
domUrl.value = this.configsCopyValue 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'))
}, },
syntaxHighlight (json) { syntaxHighlight (json) {
if (typeof json != 'string') { if (typeof json != 'string') {

View File

@@ -1423,15 +1423,9 @@ export default {
}, },
copyValue () { copyValue () {
const domUrl = document.createElement('input') this.$copyText(this.configsCopyValue).then(() => {
domUrl.value = this.configsCopyValue 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'))
}, },
copyLogsValue (index) { copyLogsValue (index) {
const domUrl = document.createElement('input') const domUrl = document.createElement('input')

View File

@@ -384,15 +384,9 @@ export default {
element.click() element.click()
}, },
copyValue () { copyValue () {
const domUrl = document.createElement('input') this.$copyText(this.fileContent).then(() => {
domUrl.value = this.fileContent 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'))
}, },
fileClosed () { fileClosed () {
this.personalCenter() this.personalCenter()