web端优化数据加载
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user