diff --git a/frontend/src/components/TopCrumb/index.vue b/frontend/src/components/TopCrumb/index.vue new file mode 100644 index 00000000..16546384 --- /dev/null +++ b/frontend/src/components/TopCrumb/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/frontend/src/components/TopTags/index.vue b/frontend/src/components/TopTags/index.vue new file mode 100644 index 00000000..86074d04 --- /dev/null +++ b/frontend/src/components/TopTags/index.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/layouts/basicLayout.vue b/frontend/src/layouts/basicLayout.vue index ab904c85..4107b236 100644 --- a/frontend/src/layouts/basicLayout.vue +++ b/frontend/src/layouts/basicLayout.vue @@ -41,6 +41,7 @@ + @@ -126,7 +127,7 @@ - + @@ -167,6 +168,10 @@ import { useUserStore } from "@/store/index"; import { logout } from '@/api/system/auth'; import { useConfigStore, useNoticeStore } from "@/store/index"; +import topTags from '@/components/TopTags/index.vue'; +import topCrumb from '@/components/TopCrumb/index.vue'; + + const userStore = useUserStore(); // 路由相关 @@ -215,6 +220,22 @@ const handleLogout = async () => { } }; + // 设置展开的菜单 + const findParentPath = (menus: any[], targetPath: string, parentPath: string[] = []): string[] => { + for (const menu of menus) { + if (menu.key === targetPath) { + return parentPath; + } + if (menu.children?.length) { + const result = findParentPath(menu.children, targetPath, [...parentPath, menu.key]); + if (result.length) { + return result; + } + } + } + return []; + }; + // 处理菜单点击 const handleMenuClick: MenuProps['onClick'] = (menuInfo) => { menuState.openKeys = menuInfo.keyPath.slice(0, -1) as string[]; @@ -228,7 +249,8 @@ watch(() => route.path, (newPath) => { menuState.openKeys = []; menuState.selectedKeys = []; } else { - menuState.selectedKeys = [newPath]; + menuState.openKeys = findParentPath(menuState.menus, newPath); + menuState.selectedKeys = [newPath]; } }); @@ -267,22 +289,6 @@ const initMenu = () => { const currentPath = route.path; menuState.selectedKeys = [currentPath]; - // 设置展开的菜单 - const findParentPath = (menus: any[], targetPath: string, parentPath: string[] = []): string[] => { - for (const menu of menus) { - if (menu.key === targetPath) { - return parentPath; - } - if (menu.children?.length) { - const result = findParentPath(menu.children, targetPath, [...parentPath, menu.key]); - if (result.length) { - return result; - } - } - } - return []; - }; - menuState.openKeys = findParentPath(menuState.menus, currentPath); }; diff --git a/frontend/src/views/common/docs/index.vue b/frontend/src/views/common/docs/index.vue index c9f8dcd4..2da6beda 100644 --- a/frontend/src/views/common/docs/index.vue +++ b/frontend/src/views/common/docs/index.vue @@ -1,5 +1,4 @@