feat: 混合布局的左侧树关联
This commit is contained in:
parent
28db7e85a1
commit
c31c15c244
@ -84,6 +84,15 @@ const onMenuItem = (key: string) => {
|
||||
const find = findLinearArray(key);
|
||||
// 路由存在则存入并跳转,不存在则跳404
|
||||
if (find) {
|
||||
setAsideMenu(find);
|
||||
router.push(find.path);
|
||||
} else {
|
||||
router.push("/404");
|
||||
}
|
||||
};
|
||||
|
||||
// 给左侧树赋值
|
||||
const setAsideMenu = (find: Menu.MenuOptions) => {
|
||||
// 将父级的chindren给左侧树
|
||||
if (find.children && find.children.length > 0) {
|
||||
routeList.value = find.children;
|
||||
@ -91,11 +100,15 @@ const onMenuItem = (key: string) => {
|
||||
// 如果没有则直接将父级给左侧树,做一级兜底
|
||||
routeList.value = [find];
|
||||
}
|
||||
router.push(find.path);
|
||||
} else {
|
||||
router.push("/404");
|
||||
}
|
||||
};
|
||||
|
||||
// 首次进入,获取左侧菜单
|
||||
const getAsideMenu = (key: string) => {
|
||||
const { findLinearArray } = useRoutingMethod();
|
||||
const find = findLinearArray(key);
|
||||
setAsideMenu(find);
|
||||
};
|
||||
getAsideMenu(aciveRoute.value as string);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user