From 24e8d9a83681cefdc5988b0ee0097e2c6b079402 Mon Sep 17 00:00:00 2001
From: cjl <909710561@qq.com>
Date: Tue, 19 May 2026 16:47:40 +0800
Subject: [PATCH] 路由
---
src/router/dynamicRouter.js | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/router/dynamicRouter.js b/src/router/dynamicRouter.js
index 41d03a6..add82cc 100644
--- a/src/router/dynamicRouter.js
+++ b/src/router/dynamicRouter.js
@@ -51,6 +51,12 @@
component: () => import('@/views/charts/index'),
meta: { title: '������������������', icon: 'example' }
}
+const radar = {
+ path: 'charts/radar',
+ name: 'radar',
+ component: () => import('@/views/radar/index'),
+ meta: { title: '������������', icon: 'example' }
+}
const contrast = {
path: 'charts/contrast',
@@ -245,6 +251,7 @@
const ruleMapping = {
wind: wind,
car: car,
+ radar: radar,
UAV: UAV,
tend: tend,
contrast: contrast,
@@ -294,7 +301,8 @@
const routersMenu = JSON.parse(store.state.user.menus)
// ��������������������������������� ���������������������������
console.log('routersMenu', routersMenu)
- const currentRoutes = router.options.routes
+ let currentRoutes = []
+ currentRoutes = router.options.routes
if (routersMenu.length > 0) {
routersMenu.forEach(item => {
if (item.url === 'dropDown') {
@@ -352,5 +360,18 @@
// }
// currentRoutes.splice(currentRoutes.length, 0, notFound)
}
- router.addRoutes(currentRoutes)
+ console.log('currentRoutes', currentRoutes)
+ const uniqueRoutes = removeDuplicateRoutes(currentRoutes)
+ console.log('uniqueRoutes', uniqueRoutes)
+ router.addRoutes(uniqueRoutes)
+}
+function removeDuplicateRoutes(routes) {
+ const routeNames = new Set()
+ return routes.filter(route => {
+ if (routeNames.has(route.path)) {
+ return false // ������������������������������������������������
+ }
+ routeNames.add(route.path) // ������������������������
+ return true
+ })
}
--
Gitblit v1.8.0