|
|
@@ -4,7 +4,8 @@ import { useNav } from "@/layout/hooks/useNav";
|
|
|
import { transformI18n } from "@/plugins/i18n";
|
|
|
import LaySearch from "../lay-search/index.vue";
|
|
|
import LayNotice from "../lay-notice/index.vue";
|
|
|
-import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
|
|
+import { ref, toRaw, watch, onMounted, onBeforeUnmount, nextTick } from "vue";
|
|
|
+import { emitter } from "@/utils/mitt";
|
|
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
|
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
|
|
import { useTranslationLang } from "../../hooks/useTranslationLang";
|
|
|
@@ -19,6 +20,7 @@ import Check from "~icons/ep/check";
|
|
|
|
|
|
const menuRef = ref();
|
|
|
const defaultActive = ref(null);
|
|
|
+const menuKey = ref(0);
|
|
|
|
|
|
const { t, route, locale, translationCh, translationEn } =
|
|
|
useTranslationLang(menuRef);
|
|
|
@@ -46,12 +48,19 @@ function getDefaultActive(routePath) {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getDefaultActive(route.path);
|
|
|
+ emitter.on("menuRefresh", () => {
|
|
|
+ menuKey.value++;
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
nextTick(() => {
|
|
|
menuRef.value?.handleResize();
|
|
|
});
|
|
|
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ emitter.off("menuRefresh");
|
|
|
+});
|
|
|
+
|
|
|
watch(
|
|
|
() => [route.path, usePermissionStoreHook().wholeMenus],
|
|
|
() => {
|
|
|
@@ -68,6 +77,7 @@ watch(
|
|
|
>
|
|
|
<el-menu
|
|
|
ref="menuRef"
|
|
|
+ :key="menuKey"
|
|
|
router
|
|
|
mode="horizontal"
|
|
|
popper-class="pure-scrollbar"
|