monkey bf941ba71e fix: correct function name typos from WidthOut to WithOut
- Fixed spelling error in useRouteStoreWidthOut -> useRouteStoreWithOut
- Fixed spelling error in useUserStoreWidthOut -> useUserStoreWithOut
- Updated all imports and usage across affected files
- Improved code semantic correctness and consistency
2025-07-28 16:56:19 +08:00

33 lines
951 B
TypeScript

import type { App } from 'vue'
import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import { createRouterGuards } from './router-guards'
import routeModuleList from './modules'
import { ErrorPageRoute, LoginRoute, RootRoute } from '@/router/base'
import { useRouteStoreWithOut } from '@/store/modules/route'
// 菜单
// 普通路由
export const constantRouter: RouteRecordRaw[] = [LoginRoute, RootRoute, ErrorPageRoute]
const routeStore = useRouteStoreWithOut()
routeStore.setMenus(routeModuleList)
routeStore.setRouters(constantRouter.concat(routeModuleList))
const router = createRouter({
history: createWebHashHistory(''),
routes: constantRouter.concat(...routeModuleList),
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),
})
export function setupRouter(app: App) {
app.use(router)
// 创建路由守卫
createRouterGuards(router)
}
export default router