gohttpdUi/src/App.vue

47 lines
921 B
Vue
Raw Normal View History

2021-12-08 10:47:33 +08:00
<script setup lang="ts">
2021-12-31 17:19:53 +08:00
import { computed, unref } from 'vue'
import { useAppStore } from '@/store/modules/app'
2021-12-30 17:25:51 +08:00
import { ElConfigProvider } from 'element-plus'
import { VConfigGlobal } from '@/components/ConfigGlobal'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
2021-12-31 17:19:53 +08:00
import en from 'element-plus/lib/locale/lang/en'
import { isDark } from '@/utils/is'
const appStore = useAppStore()
function initDark() {
const isDarkTheme = isDark()
appStore.setIsDark(isDarkTheme)
}
initDark()
const locale = computed(() => appStore.getLang)
const setLocale = computed(() => (unref(locale) === 'zh-cn' ? zhCn : en))
2021-12-08 10:47:33 +08:00
</script>
<template>
<VConfigGlobal>
2021-12-31 17:19:53 +08:00
<ElConfigProvider :locale="setLocale">
2021-12-30 17:25:51 +08:00
<RouterView />
</ElConfigProvider>
</VConfigGlobal>
</template>
2021-12-31 17:19:53 +08:00
<style lang="less">
.size {
width: 100%;
height: 100%;
}
html,
body {
padding: 0;
margin: 0;
.size;
#app {
.size;
}
}
</style>