web端优化数据加载

This commit is contained in:
Xwite
2024-10-15 14:55:40 +08:00
parent 5807dfa0b6
commit 41e2c4f177
21 changed files with 197 additions and 139 deletions
+14
View File
@@ -19,4 +19,18 @@ const router = createRouter({
routes: bookRoutes,
})
import { createApp } from 'vue'
import App from '@/App.vue'
import store, { useBookStore } from '@/store'
// init pinia instance
createApp(App).use(store)
router.beforeEach((to, from, next) => {
// 自动加载阅读配置
useBookStore()
.loadWebConfig()
.then(() => next())
.catch(() => next())
})
export default router
+15
View File
@@ -11,4 +11,19 @@ const router = createRouter({
router.afterEach(to => {
if (to.name == 'shelf') document.title = '书架'
})
import { createApp } from 'vue'
import App from '@/App.vue'
import store, { useBookStore } from '@/store'
// init pinia instance
createApp(App).use(store)
router.beforeEach((to, from, next) => {
// 自动加载阅读配置
useBookStore()
.loadWebConfig()
.then(() => next())
.catch(() => next())
})
export default router