123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <el-config-provider :locale="lang">
- <Suspense>
- <router-view></router-view>
- </Suspense>
- <keep-alive>
- <Unity v-if="route.path === '/home'" />
- </keep-alive>
- </el-config-provider>
- </template>
- <script setup lang="ts">
- import { onMounted, watch } from 'vue'
- import { useI18n } from 'vue-i18n'
- import iconfontInit from '/@/utils/iconfont'
- import { useRoute } from 'vue-router'
- import { setTitleFromRoute } from '/@/utils/common'
- import { useConfig } from '/@/stores/config'
- import { useTerminal } from '/@/stores/terminal'
- // modules import mark, Please do not remove.
- const config = useConfig()
- const route = useRoute()
- const terminal = useTerminal()
- // 初始化 element 的语言包
- const { getLocaleMessage } = useI18n()
- const lang = getLocaleMessage(config.lang.defaultLang) as any
- onMounted(() => {
- iconfontInit()
- terminal.init()
- // Modules onMounted mark, Please do not remove.
- })
- // 监听路由变化时更新浏览器标题
- watch(
- () => route.path,
- () => {
- setTitleFromRoute()
- if( route.path === '/yiqi'){
- document.getElementById('app')!.style.setProperty("background","rgb(0,17,52)","important");
- // document.getElementById('app')!.style.setProperty("background","#000f2e","important");
- }else if(route.path === '/home'){
- document.getElementById('app')!.style.setProperty("background","none","important");
- }
- else {
- document.getElementById('app')!.style.setProperty("background","#f5f5f5","important");
- }
- }
- ,{immediate: true}
- )
- </script>
|