-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathApp.vue
43 lines (36 loc) · 932 Bytes
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
<el-config-provider :locale="locale">
<router-view></router-view>
</el-config-provider>
<!-- 刷新页面遮罩 -->
<teleport to="#topSlot">
<div class="fixed top-0 bottom-0 w-full h-full bg-white z-10" v-if="isReloadMask">
<div id="top-loader"></div>
</div>
</teleport>
</template>
<script setup>
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import en from "element-plus/dist/locale/en.mjs";
import { ref, computed, onMounted, watch } from "vue";
import { useLayout } from "@/hooks/useLayout.js";
// 遮罩
const isReloadMask = ref(true);
onMounted(() => {
setTimeout(() => {
isReloadMask.value = false;
}, 1000);
});
const { isZh, isGray, toggleGray } = useLayout();
// 国际化
const locale = computed(() => (isZh.value ? zhCn : en));
// 全站置灰
watch(
isGray,
() => {
toggleGray();
},
{ immediate: true }
);
</script>
<style lang="scss"></style>