perf: add static router

This commit is contained in:
kailong321200875
2022-07-30 10:05:53 +08:00
parent 55d4ce7e35
commit 55522b0661
7 changed files with 48 additions and 7 deletions

View File

@@ -130,7 +130,17 @@ const signIn = async () => {
if (res) {
wsCache.set(appStore.getUserInfo, res.data)
getRole()
// 是否使用动态路由
if (appStore.getDynamicRouter) {
getRole()
} else {
await permissionStore.generateRoutes('none').catch(() => {})
permissionStore.getAddRouters.forEach((route) => {
addRoute(route as RouteRecordRaw) // 动态添加可访问路由表
})
permissionStore.setIsAddRouters(true)
push({ path: redirect.value || permissionStore.addRouters[0].path })
}
}
} finally {
loading.value = false