Skip to content

Commit 65ba45f

Browse files
committed
fix: antdesign dark not work
1 parent a06c8f0 commit 65ba45f

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

apps/web-antd/src/app.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { computed } from 'vue';
44
import { GlobalProvider } from '@vben/universal-ui';
55
import { preferences, usePreferences } from '@vben-core/preferences';
66
7-
import { ConfigProvider, theme } from 'ant-design-vue';
7+
import { App, ConfigProvider, theme } from 'ant-design-vue';
88
import zhCN from 'ant-design-vue/es/locale/zh_CN';
99
import dayjs from 'dayjs';
1010
@@ -17,16 +17,17 @@ dayjs.locale(zhCN.locale);
1717
const { isDark } = usePreferences();
1818
1919
const tokenTheme = computed(() => {
20-
const algorithms = isDark.value
20+
const algorithm = isDark.value
2121
? [theme.darkAlgorithm]
2222
: [theme.defaultAlgorithm];
2323
2424
// antd 紧凑模式算法
2525
if (preferences.app.compact) {
26-
algorithms.push(theme.compactAlgorithm);
26+
algorithm.push(theme.compactAlgorithm);
2727
}
28+
2829
return {
29-
algorithms,
30+
algorithm,
3031
token: { colorPrimary: preferences.theme.colorPrimary },
3132
};
3233
});
@@ -35,7 +36,9 @@ const tokenTheme = computed(() => {
3536
<template>
3637
<GlobalProvider>
3738
<ConfigProvider :locale="zhCN" :theme="tokenTheme">
38-
<RouterView />
39+
<App>
40+
<RouterView />
41+
</App>
3942
</ConfigProvider>
4043
</GlobalProvider>
4144
</template>

apps/web-antd/src/views/_essential/authentication/login.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { AuthenticationLogin } from '@vben/universal-ui';
99
import { useRequest } from '@vben-core/request';
1010
import { useAccessStore } from '@vben-core/stores';
1111
12-
import { notification } from 'ant-design-vue';
12+
import { App } from 'ant-design-vue';
1313
1414
import { getUserInfo, userLogin } from '#/apis';
1515
1616
defineOptions({ name: 'Login' });
1717
1818
const router = useRouter();
1919
const accessStore = useAccessStore();
20+
const { notification } = App.useApp();
2021
2122
const { loading, runAsync: runUserLogin } = useRequest(userLogin, {
2223
manual: true,

packages/@core/shared/design/src/scss/common/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ html {
77
overscroll-behavior: none;
88
}
99

10+
.ant-app {
11+
color: inherit;
12+
}
13+
1014
*,
1115
::after,
1216
::before {

0 commit comments

Comments
 (0)