You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
<script lang="ts" name="APP" setup>
|
|
import { isDark } from '@/utils/is'
|
|
import { useAppStore } from '@/store/modules/app'
|
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
import { CACHE_KEY } from '@/hooks/web/useCache'
|
|
import routerSearch from '@/components/RouterSearch/index.vue'
|
|
import cache from '@/plugins/cache'
|
|
|
|
const { getPrefixCls } = useDesign()
|
|
const prefixCls = getPrefixCls('app')
|
|
const appStore = useAppStore()
|
|
const currentSize = computed(() => appStore.getCurrentSize)
|
|
const greyMode = computed(() => appStore.getGreyMode)
|
|
|
|
// 根据浏览器当前主题设置系统主题色
|
|
const setDefaultTheme = () => {
|
|
let isDarkTheme = cache.local.get(CACHE_KEY.IS_DARK)
|
|
if (isDarkTheme === null) {
|
|
isDarkTheme = isDark()
|
|
}
|
|
appStore.setIsDark(isDarkTheme)
|
|
}
|
|
setDefaultTheme()
|
|
</script>
|
|
<template>
|
|
<ConfigGlobal :size="currentSize">
|
|
<RouterView :class="greyMode ? `${prefixCls}-grey-mode` : ''" />
|
|
<routerSearch />
|
|
</ConfigGlobal>
|
|
</template>
|
|
<style lang="scss">
|
|
$prefix-cls: #{$namespace}-app;
|
|
|
|
.size {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
html,
|
|
body {
|
|
padding: 0 !important;
|
|
margin: 0;
|
|
overflow: hidden;
|
|
@extend .size;
|
|
|
|
#app {
|
|
@extend .size;
|
|
}
|
|
}
|
|
|
|
.#{$prefix-cls}-grey-mode {
|
|
filter: grayscale(100%);
|
|
}
|
|
</style>
|
|
|