fix: 修改配置路由写法以修复热更新问题
This commit is contained in:
parent
df378f784b
commit
f3c391c031
@ -5,7 +5,7 @@ import { basicRoutes } from './routes'
|
||||
const isHash = !!import.meta.env.VITE_APP_USE_HASH
|
||||
export const router = createRouter({
|
||||
history: isHash ? createWebHashHistory('/') : createWebHistory('/'),
|
||||
routes: basicRoutes,
|
||||
routes: [],
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
})
|
||||
|
||||
@ -20,6 +20,9 @@ export function resetRouter() {
|
||||
}
|
||||
|
||||
export function setupRouter(app) {
|
||||
basicRoutes.forEach((route) => {
|
||||
!router.hasRoute(route.name) && router.addRoute(route)
|
||||
})
|
||||
app.use(router)
|
||||
setupRouterGuard(router)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user