diff --git a/ruoyi-fastapi-frontend/src/components/Breadcrumb/index.vue b/ruoyi-fastapi-frontend/src/components/Breadcrumb/index.vue index f368087..c13e5e9 100644 --- a/ruoyi-fastapi-frontend/src/components/Breadcrumb/index.vue +++ b/ruoyi-fastapi-frontend/src/components/Breadcrumb/index.vue @@ -28,7 +28,7 @@ function getBreadcrumb() { if (index !== 0) item = item.slice(1) return item }) - getMatched(pathList, permissionStore.sidebarRouters, matched) + getMatched(pathList, permissionStore.defaultRoutes, matched) } else { matched = route.matched.filter((item) => item.meta && item.meta.title) } @@ -48,11 +48,13 @@ function findPathNum(str, char = "/") { return num } function getMatched(pathList, routeList, matched) { - let data = routeList.find((item) => item.path == pathList[0]) - matched.push(data) - if (data.children && pathList.length) { - pathList.shift() - getMatched(pathList, data.children, matched) + let data = routeList.find(item => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0]) + if (data) { + matched.push(data) + if (data.children && pathList.length) { + pathList.shift() + getMatched(pathList, data.children, matched) + } } } function isDashboard(route) { diff --git a/ruoyi-fastapi-frontend/src/layout/components/Sidebar/SidebarItem.vue b/ruoyi-fastapi-frontend/src/layout/components/Sidebar/SidebarItem.vue index 3a85e7e..b43bca7 100644 --- a/ruoyi-fastapi-frontend/src/layout/components/Sidebar/SidebarItem.vue +++ b/ruoyi-fastapi-frontend/src/layout/components/Sidebar/SidebarItem.vue @@ -57,11 +57,9 @@ function hasOneShowingChild(children = [], parent) { const showingChildren = children.filter(item => { if (item.hidden) { return false - } else { - // Temp set(will be used if only has one showing child) - onlyOneChild.value = item - return true } + onlyOneChild.value = item + return true }) // When there is only one child router, the child router is displayed by default diff --git a/ruoyi-fastapi-frontend/src/plugins/cache.js b/ruoyi-fastapi-frontend/src/plugins/cache.js index 6b5c00b..b67d453 100644 --- a/ruoyi-fastapi-frontend/src/plugins/cache.js +++ b/ruoyi-fastapi-frontend/src/plugins/cache.js @@ -26,6 +26,7 @@ const sessionCache = { if (value != null) { return JSON.parse(value) } + return null }, remove (key) { sessionStorage.removeItem(key); @@ -59,6 +60,7 @@ const localCache = { if (value != null) { return JSON.parse(value) } + return null }, remove (key) { localStorage.removeItem(key); diff --git a/ruoyi-fastapi-frontend/src/router/index.js b/ruoyi-fastapi-frontend/src/router/index.js index 60b057f..e8b982d 100644 --- a/ruoyi-fastapi-frontend/src/router/index.js +++ b/ruoyi-fastapi-frontend/src/router/index.js @@ -166,9 +166,8 @@ const router = createRouter({ scrollBehavior(to, from, savedPosition) { if (savedPosition) { return savedPosition - } else { - return { top: 0 } } + return { top: 0 } }, }); diff --git a/ruoyi-fastapi-frontend/src/views/system/role/index.vue b/ruoyi-fastapi-frontend/src/views/system/role/index.vue index fe44263..367ebd0 100644 --- a/ruoyi-fastapi-frontend/src/views/system/role/index.vue +++ b/ruoyi-fastapi-frontend/src/views/system/role/index.vue @@ -430,8 +430,8 @@ function handleUpdate(row) { }); }); }); - title.value = "修改角色"; }); + title.value = "修改角色"; } /** 根据角色ID查询菜单树结构 */ function getRoleMenuTreeselect(roleId) { @@ -535,8 +535,8 @@ function handleDataScope(row) { }); }); }); - title.value = "分配数据权限"; }); + title.value = "分配数据权限"; } /** 提交按钮(数据权限) */ function submitDataScope() {