From 25b4dfe0065b0eeb678c83cb0dbba132a0573650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= <2178503051@qq.com> Date: Tue, 23 Jun 2026 14:35:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(sub-nav,redirect-menu):=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E8=B7=AF=E7=94=B1=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E4=BC=A0=E9=80=92query=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一在SubNav和redirectMenu组件中处理路由的完整路径,支持解析字符串格式的query参数,将其转换为对象格式存入_fullPath字段,保留原有的路径处理逻辑 --- klp-ui/src/layout/components/SubNav.vue | 10 +++++++++- klp-ui/src/views/redirectMenu.vue | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/klp-ui/src/layout/components/SubNav.vue b/klp-ui/src/layout/components/SubNav.vue index cc90bc73..424d4eef 100644 --- a/klp-ui/src/layout/components/SubNav.vue +++ b/klp-ui/src/layout/components/SubNav.vue @@ -146,10 +146,18 @@ export default { const ownPath = c.path.startsWith('/') ? c.path : path.resolve(parentPath, c.path) const title = (c.meta && c.meta.title) || c.name || c.path const hasChildren = c.children && c.children.length > 0 && c.children.some(gc => !gc.hidden) + let routeFullPath = ownPath + if (c.query) { + try { + routeFullPath = { path: ownPath, query: JSON.parse(c.query) } + } catch (e) { + routeFullPath = ownPath + } + } const item = { ...c, _ownPath: ownPath, - _fullPath: ownPath, + _fullPath: routeFullPath, _title: title, _hasChildren: hasChildren } diff --git a/klp-ui/src/views/redirectMenu.vue b/klp-ui/src/views/redirectMenu.vue index cfba940d..ea9851a6 100644 --- a/klp-ui/src/views/redirectMenu.vue +++ b/klp-ui/src/views/redirectMenu.vue @@ -75,10 +75,18 @@ export default { const ownPath = c.path.startsWith('/') ? c.path : path.resolve(parentPath, c.path) const title = (c.meta && c.meta.title) || c.name || c.path || '' const hasChildren = c.children && c.children.length > 0 && c.children.some(gc => !gc.hidden) + let routeFullPath = ownPath + if (c.query) { + try { + routeFullPath = { path: ownPath, query: JSON.parse(c.query) } + } catch (e) { + routeFullPath = ownPath + } + } const item = { ...c, _ownPath: ownPath, - _fullPath: ownPath, + _fullPath: routeFullPath, _title: title, _hasChildren: hasChildren }