Skip to content

Commit

Permalink
vite-config中将ant-design-vue升级到版本4 (#3089)
Browse files Browse the repository at this point in the history
* fix: #3077 最新代码 ApiTransfer编辑后无法正常显示数据

* feat: 升级ant-design-vue至4.0.3

* feat: vite-config up to antd v4

* fix: 去掉console
  • Loading branch information
DesignHhuang committed Sep 28, 2023
1 parent b5bdb53 commit c315aa9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 44 deletions.
2 changes: 1 addition & 1 deletion internal/vite-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/fs-extra": "^11.0.1",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"ant-design-vue": "^3.2.20",
"ant-design-vue": "^4.0.3",
"dayjs": "^1.11.9",
"dotenv": "^16.3.1",
"fs-extra": "^11.1.1",
Expand Down
15 changes: 11 additions & 4 deletions internal/vite-config/src/utils/modifyVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { resolve } from 'node:path';

import { generate } from '@ant-design/colors';
// @ts-ignore: typo
import { getThemeVariables } from 'ant-design-vue/dist/theme';
/* import { getThemeVariables } from 'ant-design-vue/dist/theme'; */
import { theme } from 'ant-design-vue/lib';
import convertLegacyToken from 'ant-design-vue/lib/theme/convertLegacyToken';

const { defaultAlgorithm, defaultSeed } = theme;

const primaryColor = '#0960bd';

Expand All @@ -25,11 +29,14 @@ export function generateModifyVars() {
primaryColorObj[`primary-${index + 1}`] = palettes[index];
}

const modifyVars = getThemeVariables();
// const modifyVars = getThemeVariables();
const mapToken = defaultAlgorithm(defaultSeed);
const v3Token = convertLegacyToken(mapToken);

return {
...modifyVars,
...v3Token,
// reference: Avoid repeated references
hack: `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`,
hack: `true; @import (reference) "${resolve('src/design/config.less')}";`,
'primary-color': primary,
...primaryColorObj,
'info-color': primary,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@vueuse/core": "^10.2.1",
"@vueuse/shared": "^10.2.1",
"@zxcvbn-ts/core": "^3.0.2",
"ant-design-vue": "^4.0.2",
"ant-design-vue": "^4.0.3",
"axios": "^1.4.0",
"codemirror": "^5.65.12",
"cropperjs": "^1.5.13",
Expand Down
55 changes: 17 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c315aa9

Please sign in to comment.