修复开启TopNav后一级菜单路由参数设置无效问题

This commit is contained in:
LiuHao 2023-05-05 10:36:21 +08:00
parent 2885d7e31c
commit ec29c057c4
2 changed files with 9 additions and 2 deletions

View File

@ -104,7 +104,7 @@ const setVisibleNumber = () => {
visibleNumber.value = parseInt(String(width / 85));
}
const handleSelect = (key: string, keyPath: string[]) => {
const handleSelect = (key: string) => {
currentIndex.value = key;
const route = routers.value.find(item => item.path === key);
if (isHttp(key)) {
@ -112,7 +112,13 @@ const handleSelect = (key: string, keyPath: string[]) => {
window.open(key, "_blank");
} else if (!route || !route.children) {
//
router.push({ path: key, fullPath: '' });
const routeMenu = childrenMenus.value.find(item => item.path === key);
if (routeMenu && routeMenu.query) {
let query = JSON.parse(routeMenu.query);
router.push({ path: key, query: query });
} else {
router.push({ path: key });
}
appStore.toggleSideBarHide(true);
} else {
//

View File

@ -13,6 +13,7 @@ declare module 'vue-router' {
title: string;
icon: string;
};
query?: string;
} & RouteRecordRaw;
interface _RouteLocationBase {