Style(App.vue): 代码格式化
This commit is contained in:
45
src/App.vue
45
src/App.vue
@@ -1,40 +1,43 @@
|
||||
<template>
|
||||
<el-config-provider :locale="locale">
|
||||
<router-view/>
|
||||
<router-view />
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { ElConfigProvider } from "element-plus";
|
||||
|
||||
import {computed, onMounted, ref, watch} from "vue";
|
||||
import {ElConfigProvider} from 'element-plus'
|
||||
import {localStorage} from "@/utils/storage";
|
||||
|
||||
import { localStorage } from "@/utils/storage";
|
||||
import useStore from "@/store";
|
||||
|
||||
//官方文档: https://element-plus.gitee.io/zh-CN/guide/i18n.html
|
||||
|
||||
// 导入 Element Plus 语言包
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import en from 'element-plus/es/locale/lang/en'
|
||||
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
||||
import en from "element-plus/es/locale/lang/en";
|
||||
|
||||
const {app} =useStore()
|
||||
const language = computed(() => app.language)
|
||||
const { app } = useStore();
|
||||
const language = computed(() => app.language);
|
||||
|
||||
const locale = ref()
|
||||
watch(language, (value) => {
|
||||
if (value == 'en') {
|
||||
locale.value = en
|
||||
} else {
|
||||
locale.value = zhCn
|
||||
const locale = ref();
|
||||
watch(
|
||||
language,
|
||||
(value) => {
|
||||
if (value == "en") {
|
||||
locale.value = en;
|
||||
} else {
|
||||
locale.value = zhCn;
|
||||
}
|
||||
},
|
||||
{
|
||||
// 初始化立即执行,
|
||||
immediate: true,
|
||||
}
|
||||
}, {
|
||||
// 初始化立即执行,
|
||||
immediate: true
|
||||
})
|
||||
onMounted(()=>{
|
||||
);
|
||||
onMounted(() => {
|
||||
const style = localStorage.get("style");
|
||||
document.documentElement.style.cssText = style as string;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user