chengxiangling
2025-05-11 afc9cf3495a99839d098430bf0b2d1d97096a7db
提交keep-alive功能优化
已修改1个文件
16 ■■■■■ 文件已修改
src/App.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue
@@ -1,8 +1,5 @@
<template>
  <el-config-provider :locale="locale === 'zh' ? zhCnEl : enUsEl">
    <!-- <keep-alive :include="cachedViewsList">
      <router-view />
    </keep-alive> -->
    <router-view />
  </el-config-provider>
</template>
@@ -14,21 +11,8 @@
import { useI18n } from "vue-i18n"; //要在js中使用国际化
const { locale } = useI18n();
import useSettingsStore from "@/store/modules/settings";
import useTagsViewStore from "@/store/modules/tagsView"
import { handleThemeStyle } from "@/utils/theme";
const route = useRoute();
const router = useRouter();
const cachedViewsList = ref([]);
const tagsViewStore = useTagsViewStore();
const cachedViews = function() {
  return router
    .getRoutes()
    .filter((r) => r.meta && r.meta.noCache)
    .map((r) => r.name);
};
onMounted(() => {
  cachedViewsList.value = tagsViewStore.cachedViews;
  console.log(cachedViewsList.value,"router.getRoutes()")
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme);