Commit c83a1d89 authored by hz's avatar hz

解决样式覆盖问题; npm run prettier

parent 25c42c38
...@@ -41,10 +41,21 @@ export default config => { ...@@ -41,10 +41,21 @@ export default config => {
outFile, outFile,
}, },
]); ]);
config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [{ config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [
{
fileName: 'css/theme-colors.css', fileName: 'css/theme-colors.css',
matchColors: generate('#1890ff'), // 主色系列 matchColors: generate('#1890ff'), // 主色系列
}]); // 改变样式选择器,解决样式覆盖问题
changeSelector(selector) {
switch (selector) {
case '.ant-calendar-today .ant-calendar-date':
return ':not(.ant-calendar-selected-day)' + selector;
default:
return selector;
}
},
},
]);
// config.plugin('ant-design-theme').use(AntDesignThemePlugin, [ // config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
// { // {
// antDir: path.join(__dirname, '../node_modules/antd'), // antDir: path.join(__dirname, '../node_modules/antd'),
......
/* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable import/no-extraneous-dependencies */
import generate from '@ant-design/colors/lib/generate'; import generate from '@ant-design/colors/lib/generate';
import client from 'webpack-theme-color-replacer/client' import client from 'webpack-theme-color-replacer/client';
export default { export default {
primaryColor: '#1890ff', primaryColor: '#1890ff',
getAntdSerials (color) { getAntdSerials(color) {
return generate(color) return generate(color);
}, },
changeColor (newColor) { changeColor(newColor) {
const lastColor = this.lastColor || this.primaryColor const lastColor = this.lastColor || this.primaryColor;
const options = { const options = {
cssUrl: '/css/theme-colors.css', // hash模式下用相对路径 cssUrl: '/css/theme-colors.css', // hash模式下用相对路径
oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors` oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors`
newColors: this.getAntdSerials(newColor || this.primaryColor) // new colors array, one-to-one corresponde with `oldColors` newColors: this.getAntdSerials(newColor || this.primaryColor), // new colors array, one-to-one corresponde with `oldColors`
} };
const promise = client.changer.changeColor(options, Promise); const promise = client.changer.changeColor(options, Promise);
this.lastColor = lastColor this.lastColor = lastColor;
return promise return promise;
} },
} };
import { message } from 'antd'; import { message } from 'antd';
import defaultSettings from '../defaultSettings'; import defaultSettings from '../defaultSettings';
import themeColorClient from '../components/SettingDrawer/themeColorClient' import themeColorClient from '../components/SettingDrawer/themeColorClient';
const updateTheme = newPrimaryColor => { const updateTheme = newPrimaryColor => {
const hideMessage = message.loading('正在切换主题!', 0) const hideMessage = message.loading('正在切换主题!', 0);
themeColorClient.changeColor(newPrimaryColor) themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage());
.finally(() => hideMessage()) };
}
/* /*
let lessNodesAppended; let lessNodesAppended;
const updateTheme = primaryColor => { const updateTheme = primaryColor => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment