Skip to content

Commit c61675b

Browse files
committed
fix: 修复后端返回路由时,因为父级auth为空字符串或数组导致子级权限失效的问题
1 parent a105df6 commit c61675b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/store/modules/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const useRouteStore = defineStore(
3636
routes.forEach((route) => {
3737
if (route.children) {
3838
const childrenBaseUrl = resolveRoutePath(baseUrl, route.path)
39-
const childrenBaseAuth = baseAuth ?? route.meta?.auth
39+
const childrenBaseAuth = !baseAuth || baseAuth === '' || baseAuth?.length === 0 ? route.meta?.auth : baseAuth
4040
const tmpBreadcrumb = cloneDeep(breadcrumb)
4141
tmpBreadcrumb.push({
4242
path: childrenBaseUrl,
@@ -82,7 +82,7 @@ const useRouteStore = defineStore(
8282
if (!tmpRoute.meta) {
8383
tmpRoute.meta = {}
8484
}
85-
tmpRoute.meta.auth = baseAuth ?? tmpRoute.meta?.auth
85+
tmpRoute.meta.auth = !baseAuth || baseAuth === '' || baseAuth?.length === 0 ? tmpRoute.meta?.auth : baseAuth
8686
tmpRoute.meta.breadcrumbNeste = tmpBreadcrumb
8787
res.push(tmpRoute)
8888
}

0 commit comments

Comments
 (0)