mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
perf: 抽离公共复制方法;账号详情增加复制功能
This commit is contained in:
committed by
Jiangjie.Bai
parent
a5dcc8be52
commit
a468e04bad
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user