fix: antdesign dark not work
parent
a06c8f039f
commit
65ba45fdc0
|
@ -4,7 +4,7 @@ import { computed } from 'vue';
|
||||||
import { GlobalProvider } from '@vben/universal-ui';
|
import { GlobalProvider } from '@vben/universal-ui';
|
||||||
import { preferences, usePreferences } from '@vben-core/preferences';
|
import { preferences, usePreferences } from '@vben-core/preferences';
|
||||||
|
|
||||||
import { ConfigProvider, theme } from 'ant-design-vue';
|
import { App, ConfigProvider, theme } from 'ant-design-vue';
|
||||||
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
@ -17,16 +17,17 @@ dayjs.locale(zhCN.locale);
|
||||||
const { isDark } = usePreferences();
|
const { isDark } = usePreferences();
|
||||||
|
|
||||||
const tokenTheme = computed(() => {
|
const tokenTheme = computed(() => {
|
||||||
const algorithms = isDark.value
|
const algorithm = isDark.value
|
||||||
? [theme.darkAlgorithm]
|
? [theme.darkAlgorithm]
|
||||||
: [theme.defaultAlgorithm];
|
: [theme.defaultAlgorithm];
|
||||||
|
|
||||||
// antd 紧凑模式算法
|
// antd 紧凑模式算法
|
||||||
if (preferences.app.compact) {
|
if (preferences.app.compact) {
|
||||||
algorithms.push(theme.compactAlgorithm);
|
algorithm.push(theme.compactAlgorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
algorithms,
|
algorithm,
|
||||||
token: { colorPrimary: preferences.theme.colorPrimary },
|
token: { colorPrimary: preferences.theme.colorPrimary },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -35,7 +36,9 @@ const tokenTheme = computed(() => {
|
||||||
<template>
|
<template>
|
||||||
<GlobalProvider>
|
<GlobalProvider>
|
||||||
<ConfigProvider :locale="zhCN" :theme="tokenTheme">
|
<ConfigProvider :locale="zhCN" :theme="tokenTheme">
|
||||||
<RouterView />
|
<App>
|
||||||
|
<RouterView />
|
||||||
|
</App>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</GlobalProvider>
|
</GlobalProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { AuthenticationLogin } from '@vben/universal-ui';
|
||||||
import { useRequest } from '@vben-core/request';
|
import { useRequest } from '@vben-core/request';
|
||||||
import { useAccessStore } from '@vben-core/stores';
|
import { useAccessStore } from '@vben-core/stores';
|
||||||
|
|
||||||
import { notification } from 'ant-design-vue';
|
import { App } from 'ant-design-vue';
|
||||||
|
|
||||||
import { getUserInfo, userLogin } from '#/apis';
|
import { getUserInfo, userLogin } from '#/apis';
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ defineOptions({ name: 'Login' });
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
|
const { notification } = App.useApp();
|
||||||
|
|
||||||
const { loading, runAsync: runUserLogin } = useRequest(userLogin, {
|
const { loading, runAsync: runUserLogin } = useRequest(userLogin, {
|
||||||
manual: true,
|
manual: true,
|
||||||
|
|
|
@ -7,6 +7,10 @@ html {
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-app {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
*,
|
*,
|
||||||
::after,
|
::after,
|
||||||
::before {
|
::before {
|
||||||
|
|
Loading…
Reference in New Issue