This commit is contained in:
Dede Fuji Abdul
2023-10-27 13:51:43 +07:00
parent 356102c20f
commit 7c6212c37b
2 changed files with 8 additions and 12 deletions

View File

@ -40,18 +40,8 @@ export const useMenuStore = defineStore('menu', () => {
}
const toggleSidebarDesktop = () => (sidebarShowed.value = !sidebarShowed.value)
watch(router, (value) => {
if (value.currentRoute.value.fullPath === '/' || value.currentRoute.value.fullPath === '/home') {
for (const item of navigation.value) {
item.expanded = false
}
}
})
watch(menuSelected, (value) => {
if (value !== '/login' && value !== '/404' && value !== '/home' && value !== '/') {
console.log('current route', value);
const result = command.searchRoutesPath(routes, value)
if (result.length > 0) {
const route = result.find((item) => item.path === value)
@ -59,7 +49,12 @@ export const useMenuStore = defineStore('menu', () => {
command.addRecent(route)
}
}
} else {
if (value === '/' || value === '/home') {
for (const item of navigation.value) {
item.expanded = false
}
}
}
})