mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-25 07:57:18 +08:00
perf: 同步完整版代码
This commit is contained in:
parent
eb9d1e8238
commit
aea8605a60
@ -45,6 +45,13 @@ watch(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.path,
|
||||||
|
() => {
|
||||||
|
menuSelect(route.path, routers);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function translationCh() {
|
function translationCh() {
|
||||||
instance.locale = { locale: "zh" };
|
instance.locale = { locale: "zh" };
|
||||||
locale.value = "zh";
|
locale.value = "zh";
|
||||||
|
@ -49,7 +49,10 @@ onBeforeMount(() => {
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => getSubMenuData(route.path)
|
() => {
|
||||||
|
getSubMenuData(route.path);
|
||||||
|
menuSelect(route.path, routers);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import { storageSession } from "/@/utils/storage";
|
|||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
import { Title } from "../../../public/serverConfig.json";
|
import { Title } from "../../../public/serverConfig.json";
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
||||||
|
import { remainingPaths } from "/@/router/modules/index";
|
||||||
|
|
||||||
export function useNav() {
|
export function useNav() {
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
@ -67,6 +68,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menuSelect(indexPath: string, routers): void {
|
function menuSelect(indexPath: string, routers): void {
|
||||||
|
if (isRemaining(indexPath)) return;
|
||||||
let parentPath = "";
|
let parentPath = "";
|
||||||
const parentPathIndex = indexPath.lastIndexOf("/");
|
const parentPathIndex = indexPath.lastIndexOf("/");
|
||||||
if (parentPathIndex > 0) {
|
if (parentPathIndex > 0) {
|
||||||
@ -93,6 +95,11 @@ export function useNav() {
|
|||||||
findCurrentRoute(indexPath, routers);
|
findCurrentRoute(indexPath, routers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断路径是否参与菜单
|
||||||
|
function isRemaining(path: string): boolean {
|
||||||
|
return remainingPaths.includes(path);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
logout,
|
logout,
|
||||||
backHome,
|
backHome,
|
||||||
|
@ -24,3 +24,8 @@ export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|||||||
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(
|
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(
|
||||||
...remainingRouter
|
...remainingRouter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 不参与菜单的路由
|
||||||
|
export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
||||||
|
return remainingRouter[v].path;
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user