|
@@ -2,7 +2,6 @@ import client from 'webpack-theme-color-replacer/client'
|
|
|
import generate from '@ant-design/colors/lib/generate'
|
|
|
|
|
|
export default {
|
|
|
- primaryColor: '#1890ff',
|
|
|
getAntdSerials (color) {
|
|
|
// 淡化(即less的tint)
|
|
|
const lightens = new Array(9).fill().map((t, i) => {
|
|
@@ -13,14 +12,12 @@ export default {
|
|
|
return lightens.concat(colorPalettes)
|
|
|
},
|
|
|
changeColor (newColor) {
|
|
|
- var lastColor = this.lastColor || this.primaryColor
|
|
|
var options = {
|
|
|
- cssUrl: '/css/theme-colors.css',
|
|
|
- oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors`
|
|
|
- newColors: this.getAntdSerials(newColor) // new colors array, one-to-one corresponde with `oldColors`
|
|
|
+ newColors: this.getAntdSerials(newColor), // new colors array, one-to-one corresponde with `matchColors`
|
|
|
+ changeUrl (cssUrl) {
|
|
|
+ return `/${cssUrl}` // while router is not `hash` mode, it needs absolute path
|
|
|
+ }
|
|
|
}
|
|
|
- var promise = client.changer.changeColor(options, Promise)
|
|
|
- this.lastColor = lastColor
|
|
|
- return promise
|
|
|
+ return client.changer.changeColor(options, Promise)
|
|
|
}
|
|
|
}
|