mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 15:48:05 +08:00
21 lines
493 B
TypeScript
Executable File
21 lines
493 B
TypeScript
Executable File
import useMenuStore from '@/store/modules/menu'
|
|
import useSettingsStore from '@/store/modules/settings'
|
|
|
|
export default function useMenu() {
|
|
const router = useRouter()
|
|
|
|
const settingsStore = useSettingsStore()
|
|
const menuStore = useMenuStore()
|
|
|
|
function switchTo(index: number | string) {
|
|
menuStore.setActived(index)
|
|
if (settingsStore.settings.menu.switchMainMenuAndPageJump) {
|
|
router.push(menuStore.sidebarMenusFirstDeepestPath)
|
|
}
|
|
}
|
|
|
|
return {
|
|
switchTo,
|
|
}
|
|
}
|