wujingjing
2025-02-24 d3efce76cd9698b364e1db3e17aec2f7ee36d0d9
src/layout/navMenu/vertical.vue
@@ -31,12 +31,13 @@
</template>
<script setup lang="ts" name="navMenuVertical">
import { defineAsyncComponent, reactive, computed, onMounted, watch } from 'vue';
import { useRoute, onBeforeRouteUpdate, RouteRecordRaw } from 'vue-router';
import { storeToRefs } from 'pinia';
import { computed, defineAsyncComponent, onMounted, reactive, watch } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
import { onBeforeRouteUpdate, useRoute } from 'vue-router';
import { MOBILE_MIN_WIDTH } from '/@/constants';
import { useThemeConfig } from '/@/stores/themeConfig';
import other from '/@/utils/other';
import { MenuTypeEnum } from '/@/api/menu/type';
// 引入组件
const SubItem = defineAsyncComponent(() => import('/@/layout/navMenu/subItem.vue'));
@@ -100,13 +101,13 @@
   // 修复:https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
   state.defaultActive = setParentHighlight(to);
   const clientWidth = document.body.clientWidth;
   if (clientWidth < 1000) themeConfig.value.isCollapse = false;
   if (clientWidth < MOBILE_MIN_WIDTH) themeConfig.value.isCollapse = false;
});
// 设置菜单的收起/展开
watch(
   themeConfig.value,
   () => {
      document.body.clientWidth <= 1000 ? (state.isCollapse = false) : (state.isCollapse = themeConfig.value.isCollapse);
      document.body.clientWidth <= MOBILE_MIN_WIDTH ? (state.isCollapse = false) : (state.isCollapse = themeConfig.value.isCollapse);
   },
   {
      immediate: true,