CET-vue-3.0/src/App.vue

80 lines
2.4 KiB
Vue
Raw Normal View History

2021-10-20 14:32:09 +08:00
<template>
2023-12-29 21:41:35 +08:00
<ConfigProvider :theme="appTheme" :locale="getAntdLocale">
2021-10-20 14:32:09 +08:00
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
2023-12-29 21:41:35 +08:00
import { watch, ref } from 'vue';
import { theme } from 'ant-design-vue';
2021-10-20 14:32:09 +08:00
import { ConfigProvider } from 'ant-design-vue';
import { AppProvider } from '/@/components/Application';
import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
2023-12-29 21:41:35 +08:00
import { useAppStore } from '/@/store/modules/app';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import { ThemeEnum } from '/@/enums/appEnum';
import { changeTheme } from '/@/logics/theme/index';
2021-10-20 14:32:09 +08:00
2023-12-29 21:41:35 +08:00
const appStore = useAppStore();
// 解决日期时间国际化问题
import 'dayjs/locale/zh-cn';
2021-10-20 14:32:09 +08:00
// support Multi-language
const { getAntdLocale } = useLocale();
useTitle();
2023-12-29 21:41:35 +08:00
// update-begin--author:liaozhiyang---date:20231218---for【QQYUN-6366】升级到antd4.x
const appTheme: any = ref({});
const { getDarkMode } = useRootSetting();
watch(
() => getDarkMode.value,
(newValue) => {
delete appTheme.value.algorithm;
if (newValue === ThemeEnum.DARK) {
appTheme.value.algorithm = theme.darkAlgorithm;
}
appTheme.value = {
...appTheme.value,
};
},
{ immediate: true }
);
watch(
appStore.getProjectConfig,
(newValue) => {
const primary = newValue.themeColor;
appTheme.value = {
...appTheme.value,
...{
token: {
colorPrimary: primary,
wireframe: true,
fontSize: 14,
colorSuccess: '#55D187',
colorInfo: primary,
borderRadius: 2,
sizeStep: 4,
sizeUnit: 4,
colorWarning: '#EFBD47',
colorError: '#ED6F6F',
},
},
};
},
{ immediate: true }
);
setTimeout(() => {
appStore.getProjectConfig?.themeColor && changeTheme(appStore.getProjectConfig.themeColor);
}, 300);
// update-end--author:liaozhiyang---date:20231218---for【QQYUN-6366】升级到antd4.x
2021-10-20 14:32:09 +08:00
</script>
<style lang="less">
2023-12-29 21:41:35 +08:00
// update-begin--author:liaozhiyang---date:20230803---for【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
img {
display: inline-block;
}
// update-end--author:liaozhiyang---date:20230803---for【QQYUN-5839】windi会影响到html2canvas绘制的图片样式
</style>