Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 19:09:21 +08:00

style: rename the variable "whether to enable dynamic routing" from "async" to "dynamic"

This commit is contained in:
Aaron-zon 2024-02-25 19:12:51 +08:00 committed by GitHub
parent 01249a4f5a
commit 9963b590fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ interface RouteSettings {
* 1. roles
* 2. async: false
*/
async: boolean
dynamic: boolean
/**
* 1. 访
* 2.
@ -20,7 +20,7 @@ interface RouteSettings {
}
const routeSettings: RouteSettings = {
async: true,
dynamic: true,
defaultRoles: ["DEFAULT_ROLE"],
thirdLevelRouteCache: false
}

View File

@ -41,7 +41,7 @@ router.beforeEach(async (to, _from, next) => {
// 注意:角色必须是一个数组! 例如: ["admin"] 或 ["developer", "editor"]
const roles = userStore.roles
// 生成可访问的 Routes
routeSettings.async ? permissionStore.setRoutes(roles) : permissionStore.setAllRoutes()
routeSettings.dynamic ? permissionStore.setRoutes(roles) : permissionStore.setAllRoutes()
// 将 "有访问权限的动态路由" 添加到 Router 中
permissionStore.dynamicRoutes.forEach((route) => router.addRoute(route))
// 确保添加路由已完成