perf: 抽离公共复制方法;账号详情增加复制功能

This commit is contained in:
“huailei000”
2023-03-22 15:00:48 +08:00
committed by Jiangjie.Bai
parent a5dcc8be52
commit a468e04bad
3 changed files with 37 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
import i18n from '@/i18n/i18n'
import { message } from '@/utils/message'
const _ = require('lodash')
const moment = require('moment')
@@ -362,4 +363,19 @@ export function diffObject(object, base) {
})
}
export const copy = _.throttle(function(value) {
const inputDom = document.createElement('input')
inputDom.id = 'createInputDom'
inputDom.value = value
document.body.appendChild(inputDom)
inputDom.select()
document?.execCommand('copy')
message({
message: i18n.t('common.CopySuccess'),
type: 'success',
duration: 1000
})
document.body.removeChild(inputDom)
}, 1400)
export { BASE_URL }