Adding loading effects when downloading a universal dictionary

This commit is contained in:
zyronon
2023-11-09 01:42:02 +08:00
parent ed032ef5b6
commit 76269c50fe
4 changed files with 17 additions and 6 deletions

3
components.d.ts vendored
View File

@@ -71,4 +71,7 @@ declare module 'vue' {
WordList2: typeof import('./src/components/list/WordList2.vue')['default']
WordListModal: typeof import('./src/components/Modal/WordListModal.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}

View File

@@ -40,17 +40,20 @@ watch(store.wrong.originWords, (n) => {
useStartKeyboardEventListener()
onMounted(() => {
async function init() {
console.time()
Promise.allSettled([store.init(), settingStore.init()]).then(e => {
store.init().then(() => {
store.load = true
setTheme(settingStore.theme)
console.timeEnd()
})
})
await settingStore.init()
setTheme(settingStore.theme)
}
onMounted(() => {
init()
})
</script>
<template>

View File

@@ -251,6 +251,7 @@ onUnmounted(() => {
</div>
</div>
<Typing
v-loading="!store.load"
ref="typingRef"
:word="word"
@wrong="wordWrong"
@@ -270,7 +271,9 @@ onUnmounted(() => {
<div class="word-panel-wrapper">
<Panel>
<template v-slot="{active}">
<div class="panel-page-item">
<div class="panel-page-item"
v-loading="!store.load"
>
<div class="list-header">
<div class="left">
<Tooltip title="切换词典">

View File

@@ -228,7 +228,9 @@ export const useBaseStore = defineStore('base', {
if (res) w = Object.assign(w, res)
})
resolve(true)
setTimeout(()=>{
resolve(true)
},5000)
})
})
} else {