Commit c16972a 1 parent 7bff562 commit c16972a Copy full SHA for c16972a
File tree 3 files changed +15
-14
lines changed
3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change 60
60
const classStyle = ref('flex flex-col parent-menu items-center rounded mt-1 text-gray-200 hover:bg-gray-700 dark:hover:text-gray-50 dark:hover:bg-blackgray-1')
61
61
62
62
onMounted(() => {
63
- initMenu()
63
+ initMenu(true )
64
64
})
65
65
66
66
watch(() => route, v => {
67
- initMenu()
67
+ initMenu(false )
68
68
}, { deep: true })
69
69
70
- const initMenu = () => {
70
+ const initMenu = (init = true ) => {
71
71
let current
72
72
if (route.matched[1]?.meta?.breadcrumb) {
73
73
current = route.matched[1].meta.breadcrumb[0].name
76
76
}
77
77
if (userStore.routers && userStore.routers.length > 0) {
78
78
userStore.routers.map((item, index) => {
79
- if (item.name == current) loadMenu(item, index)
79
+ if (item.name == current) loadMenu(item, index, init )
80
80
})
81
81
}
82
82
}
83
83
84
- const loadMenu = (bigMenu, index) => {
84
+ const loadMenu = (bigMenu, index, isInit = true ) => {
85
85
if (bigMenu.meta.type === 'L') {
86
86
window.open(bigMenu.path)
87
87
return
88
88
}
89
89
if (bigMenu.children.length > 0) {
90
- if (bigMenu.redirect) {
90
+ if (bigMenu.redirect && isInit ) {
91
91
router.push(bigMenu.redirect)
92
92
}
93
93
MaMenuRef.value.loadChildMenu(bigMenu)
Original file line number Diff line number Diff line change 51
51
const routerPush = (menu) => {
52
52
if (menu.meta && menu.meta.type === 'L') {
53
53
window.open(menu.path)
54
- } else if (menu.redirect) {
55
- router.push(menu.redirect)
56
- } else {
54
+ }else {
57
55
router.push(menu.path)
58
56
tagStore.addTag({ name: menu.name, title: menu.meta.title, path: menu.path })
59
57
}
Original file line number Diff line number Diff line change 62
62
const active = ref()
63
63
64
64
onMounted(() => {
65
- initMenu()
65
+ initMenu(true )
66
66
})
67
67
68
68
watch(() => route, v => {
69
- initMenu()
69
+ initMenu(false )
70
70
}, { deep: true })
71
71
72
- const initMenu = () => {
72
+ const initMenu = (init = true ) => {
73
73
if (route.matched[1]?.meta?.breadcrumb) {
74
74
active.value = route.matched[1].meta.breadcrumb[0].name
75
75
} else {
76
76
active.value = 'home'
77
77
}
78
78
if (userStore.routers && userStore.routers.length > 0) {
79
79
userStore.routers.map((item, index) => {
80
- if (item.name == active.value) loadMenu(item)
80
+ if (item.name == active.value) loadMenu(item, init )
81
81
})
82
82
}
83
83
}
84
84
85
- const loadMenu = (bigMenu) => {
85
+ const loadMenu = (bigMenu, isInit = true ) => {
86
86
if (bigMenu.meta.type === 'L') {
87
87
window.open(bigMenu.path)
88
88
return
89
89
}
90
90
if (bigMenu.children.length > 0) {
91
+ if (bigMenu.redirect && isInit) {
92
+ router.push(bigMenu.redirect)
93
+ }
91
94
MaMenuRef.value.loadChildMenu(bigMenu)
92
95
showMenu.value = true
93
96
} else {
You can’t perform that action at this time.
0 commit comments