修改复制方法
This commit is contained in:
parent
d685e166e1
commit
5c8546995e
@ -58,7 +58,9 @@ import LangSelect from '@/components/LangSelect/index'
|
|||||||
import useAppStore from '@/store/modules/app'
|
import useAppStore from '@/store/modules/app'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import useSettingsStore from '@/store/modules/settings'
|
import useSettingsStore from '@/store/modules/settings'
|
||||||
import { useClipboard } from '@vueuse/core'
|
// import { useClipboard } from '@vueuse/core'
|
||||||
|
import useClipboard from 'vue-clipboard3'
|
||||||
|
const { toClipboard } = useClipboard()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@ -85,13 +87,12 @@ function handleCommand(command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { copy, isSupported } = useClipboard()
|
|
||||||
const copyText = async (val) => {
|
const copyText = async (val) => {
|
||||||
if (isSupported) {
|
try {
|
||||||
copy(val)
|
await toClipboard(val)
|
||||||
proxy.$modal.msgSuccess('复制成功!')
|
proxy.$modal.msgSuccess('复制成功!')
|
||||||
} else {
|
} catch (e) {
|
||||||
alert(val)
|
console.log(e)
|
||||||
proxy.$modal.msgError('当前浏览器不支持')
|
proxy.$modal.msgError('当前浏览器不支持')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user