chenshuai2144 / umi-plugin-antd-theme

🎨 Best theme plugin
https://preview.pro.ant.design/
MIT License
85 stars 29 forks source link

使用umi用global.less时@primary-color不能随着主题切换颜色 #6

Open Nokecy opened 4 years ago

Nokecy commented 4 years ago

https://github.com/ant-design/ant-design-pro/issues/3020 @primary-color 默认一直是蓝色

holiday12138 commented 4 years ago

同样的疑问 有新版本了吗

zp2359 commented 4 years ago

同样问题: 在项目中@import '~antd/es/style/themes/default.less'; 设置color: @primary-color;

切换主题后,@primayr-color不变

chenshuai2144 commented 4 years ago

我忽略了一下 global.less ,不知道为什么

Nokecy commented 4 years ago

@chenshuai2144 能不能抽时间看一下~~~

chenshuai2144 commented 4 years ago

@Nokecy 先不要在 global.less 里面用规避一下

zp2359 commented 4 years ago

在一个普通的页面,这样写的,也无法改变颜色: image

zp2359 commented 4 years ago

我的理解是,@primary-color是定制antd组件主题用的,自己写的代码(覆盖antd组件与页面样式)要用css3 var处理,不知道理解是否正确?

lifeneedspassion commented 4 years ago

作者抽取样式的时候需要给每个css_module的类名重命名,如果不规避 global.less 的话,global.less里的类名会被多加一些前缀,导致样式不生效。 所以 global.less 里的样式是一定会规避的。 在多主题时,global.less里不能添加颜色变量,因为global.less根本不会被编译。

hemiao51 commented 3 years ago

同样的疑问 有新版本了吗

chenshuai2144 commented 3 years ago

global.less 这个文件被忽略了,要搞就需要不忽略 global.less,有点麻烦