Преглед на файлове

修复二级菜单点击: 直接router.push跳转

Lin Qilong преди 5 дни
родител
ревизия
c02f9871a0
променени са 2 файла, в които са добавени 4 реда и са изтрити 10 реда
  1. 3 1
      gw-ui/src/frontLayout/systemMenuBar.vue
  2. 1 9
      gw-ui/src/router/index.js

+ 3 - 1
gw-ui/src/frontLayout/systemMenuBar.vue

@@ -25,8 +25,10 @@
 
 <script setup>
 import { ref } from 'vue'
+import { useRouter } from 'vue-router'
 import Cookies from 'js-cookie'
 
+const router = useRouter()
 const emit = defineEmits(['addSystemMenuView'])
 const isLogin = ref(Cookies.get('isLogin') || '')
 const showDropdown = ref(false)
@@ -65,7 +67,7 @@ const menuInfos = ref([
 const onHover = (item) => { if (item.children) { dropdownChildren.value = item.children; showDropdown.value = true } }
 const onLeave = () => { keepShow.value = false; setTimeout(() => { if (!keepShow.value) showDropdown.value = false }, 150) }
 const keepOpen = () => { keepShow.value = true }
-const onClick = (item) => { showDropdown.value = false; if (item.href) emit('addSystemMenuView', { viewItem: item }) }
+const onClick = (item) => { showDropdown.value = false; if (item.href) { router.push(item.href) } }
 </script>
 
 <style scoped>

+ 1 - 9
gw-ui/src/router/index.js

@@ -61,15 +61,7 @@ export const constantRoutes = [
   {
     path: '',
     component: Layout,
-    redirect: '/index',
-    children: [
-      {
-        path: '/index',
-        component: () => import('@/views/index'),
-        name: 'Index',
-        meta: { title: '首页', icon: 'dashboard', affix: true }
-      }
-    ]
+    redirect: '/hlgl/onemap',
   },
   // ==================== 一张图(FrontLayout) ====================
   {