Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
钟摆人-Puppet゜
ant-design-pro
提交
c83a1d89
A
ant-design-pro
项目概览
钟摆人-Puppet゜
/
ant-design-pro
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design-pro
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c83a1d89
编写于
5月 26, 2019
作者:
hz932
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决样式覆盖问题; npm run prettier
上级
25c42c38
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
21 deletion
+30
-21
config/plugin.config.js
config/plugin.config.js
+15
-4
src/components/SettingDrawer/themeColorClient.js
src/components/SettingDrawer/themeColorClient.js
+11
-12
src/models/setting.js
src/models/setting.js
+4
-5
未找到文件。
config/plugin.config.js
浏览文件 @
c83a1d89
...
...
@@ -41,10 +41,21 @@ export default config => {
outFile
,
},
]);
config
.
plugin
(
'
webpack-theme-color-replacer
'
).
use
(
ThemeColorReplacer
,
[{
fileName
:
'
css/theme-colors.css
'
,
matchColors
:
generate
(
'
#1890ff
'
),
// 主色系列
}]);
config
.
plugin
(
'
webpack-theme-color-replacer
'
).
use
(
ThemeColorReplacer
,
[
{
fileName
:
'
css/theme-colors.css
'
,
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, [
// {
// antDir: path.join(__dirname, '../node_modules/antd'),
...
...
src/components/SettingDrawer/themeColorClient.js
浏览文件 @
c83a1d89
/* eslint-disable import/no-extraneous-dependencies */
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
{
primaryColor
:
'
#1890ff
'
,
getAntdSerials
(
color
)
{
return
generate
(
color
)
getAntdSerials
(
color
)
{
return
generate
(
color
)
;
},
changeColor
(
newColor
)
{
const
lastColor
=
this
.
lastColor
||
this
.
primaryColor
changeColor
(
newColor
)
{
const
lastColor
=
this
.
lastColor
||
this
.
primaryColor
;
const
options
=
{
cssUrl
:
'
/css/theme-colors.css
'
,
// hash模式下用相对路径
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
);
this
.
lastColor
=
lastColor
return
promise
}
}
this
.
lastColor
=
lastColor
;
return
promise
;
},
};
src/models/setting.js
浏览文件 @
c83a1d89
import
{
message
}
from
'
antd
'
;
import
defaultSettings
from
'
../defaultSettings
'
;
import
themeColorClient
from
'
../components/SettingDrawer/themeColorClient
'
import
themeColorClient
from
'
../components/SettingDrawer/themeColorClient
'
;
const
updateTheme
=
newPrimaryColor
=>
{
const
hideMessage
=
message
.
loading
(
'
正在切换主题!
'
,
0
)
themeColorClient
.
changeColor
(
newPrimaryColor
)
.
finally
(()
=>
hideMessage
())
}
const
hideMessage
=
message
.
loading
(
'
正在切换主题!
'
,
0
);
themeColorClient
.
changeColor
(
newPrimaryColor
).
finally
(()
=>
hideMessage
());
};
/*
let lessNodesAppended;
const updateTheme = primaryColor => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录