Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
c83a1d89
You need to sign in or sign up before continuing.
Commit
c83a1d89
authored
May 26, 2019
by
hz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决样式覆盖问题; npm run prettier
parent
25c42c38
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
21 deletions
+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
No files found.
config/plugin.config.js
View file @
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
View file @
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
View file @
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 => {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment