'admin-21.09.25:修复横向导航菜单不高亮问题'
This commit is contained in:
parent
99431138c5
commit
3f4c08c119
@ -29,7 +29,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, nextTick } from 'vue';
|
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, nextTick, onBeforeMount } from 'vue';
|
||||||
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
||||||
import { useStore } from '/@/store/index';
|
import { useStore } from '/@/store/index';
|
||||||
import SubItem from '/@/layout/navMenu/subItem.vue';
|
import SubItem from '/@/layout/navMenu/subItem.vue';
|
||||||
@ -46,7 +46,7 @@ export default defineComponent({
|
|||||||
const { proxy } = getCurrentInstance() as any;
|
const { proxy } = getCurrentInstance() as any;
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const state: any = reactive({
|
const state = reactive({
|
||||||
defaultActive: null,
|
defaultActive: null,
|
||||||
});
|
});
|
||||||
// 获取父级菜单数据
|
// 获取父级菜单数据
|
||||||
@ -101,10 +101,13 @@ export default defineComponent({
|
|||||||
else state.defaultActive = path;
|
else state.defaultActive = path;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 页面加载前
|
||||||
|
onBeforeMount(() => {
|
||||||
|
setCurrentRouterHighlight(route);
|
||||||
|
});
|
||||||
// 页面加载时
|
// 页面加载时
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initElMenuOffsetLeft();
|
initElMenuOffsetLeft();
|
||||||
setCurrentRouterHighlight(route);
|
|
||||||
});
|
});
|
||||||
// 路由更新时
|
// 路由更新时
|
||||||
onBeforeRouteUpdate((to) => {
|
onBeforeRouteUpdate((to) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user