fix: fix the problem that no reaction when copy setting config in http page

This commit is contained in:
Snoword 2022-03-14 17:19:02 +08:00
parent 106331a1c8
commit 61e0e33c64
3 changed files with 69 additions and 63 deletions

View File

@ -108,7 +108,7 @@ watch(
// //
const copyConfig = async () => { const copyConfig = async () => {
const { copy, copied } = useClipboard({ const { copy, copied, isSupported } = useClipboard({
source: ` source: `
// //
breadcrumb: ${appStore.getBreadcrumb}, breadcrumb: ${appStore.getBreadcrumb},
@ -171,11 +171,15 @@ theme: {
} }
` `
}) })
if (!isSupported) {
ElMessage.error(t('setting.copyFailed'))
} else {
await copy() await copy()
if (unref(copied)) { if (unref(copied)) {
ElMessage.success(t('setting.copySuccess')) ElMessage.success(t('setting.copySuccess'))
} }
} }
}
// //
const clear = () => { const clear = () => {

View File

@ -70,6 +70,7 @@ export default {
copy: 'Copy', copy: 'Copy',
clearAndReset: 'Clear cache and reset', clearAndReset: 'Clear cache and reset',
copySuccess: 'Copy success', copySuccess: 'Copy success',
copyFailed: 'Copy failed',
footer: 'Footer' footer: 'Footer'
}, },
size: { size: {

View File

@ -70,6 +70,7 @@ export default {
copy: '拷贝', copy: '拷贝',
clearAndReset: '清除缓存并且重置', clearAndReset: '清除缓存并且重置',
copySuccess: '拷贝成功', copySuccess: '拷贝成功',
copyFailed: '拷贝失败',
footer: '页脚' footer: '页脚'
}, },
size: { size: {