chengxiangling
2025-05-11 eedfb8fa8d1eeb83554081f5785f832f45a64f3a
src/App.vue
@@ -1,15 +1,37 @@
<template>
  <router-view />
  <el-config-provider :locale="locale === 'zh' ? zhCnEl : enUsEl">
    <!-- <keep-alive :include="cachedViewsList">
      <router-view />
    </keep-alive> -->
    <router-view />
  </el-config-provider>
</template>
<script setup>
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'
import { ElConfigProvider } from "element-plus";
import zhCnEl from "element-plus/es/locale/lang/zh-cn";
import enUsEl from "element-plus/es/locale/lang/en";
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)
  })
})
    handleThemeStyle(useSettingsStore().theme);
  });
});
</script>