74dfc60ef0
add: 字体抗锯齿
65 lines
1.2 KiB
Vue
65 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { useAppStore } from '@/store/modules/app'
|
|
import { ConfigGlobal } from '@/components/ConfigGlobal'
|
|
import { isDark } from '@/utils/is'
|
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
import Cookies from 'js-cookie'
|
|
|
|
const { getPrefixCls } = useDesign()
|
|
|
|
const prefixCls = getPrefixCls('app')
|
|
|
|
const appStore = useAppStore()
|
|
|
|
const currentSize = computed(() => appStore.getCurrentSize)
|
|
|
|
const greyMode = computed(() => appStore.getGreyMode)
|
|
|
|
// 根据浏览器当前主题设置系统主题色
|
|
const setDefaultTheme = () => {
|
|
if (Cookies.get('isDark')) {
|
|
if (Cookies.get('isDark') === 'true') {
|
|
appStore.setIsDark(true)
|
|
} else {
|
|
appStore.setIsDark(false)
|
|
}
|
|
return
|
|
}
|
|
const isDarkTheme = isDark()
|
|
appStore.setIsDark(isDarkTheme)
|
|
}
|
|
setDefaultTheme()
|
|
</script>
|
|
|
|
<template>
|
|
<ConfigGlobal :size="currentSize">
|
|
<RouterView :class="greyMode ? `${prefixCls}-grey-mode` : ''" />
|
|
</ConfigGlobal>
|
|
</template>
|
|
|
|
<style lang="less">
|
|
@prefix-cls: ~'@{namespace}-app';
|
|
|
|
.size {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
html,
|
|
body {
|
|
padding: 0 !important;
|
|
margin: 0;
|
|
overflow: hidden;
|
|
.size;
|
|
|
|
#app {
|
|
.size;
|
|
}
|
|
}
|
|
|
|
.@{prefix-cls}-grey-mode {
|
|
filter: grayscale(100%);
|
|
}
|
|
</style>
|