|
|
|
@ -12,6 +12,24 @@ const updateTheme = primaryColor => { |
|
|
|
return; |
|
|
|
} |
|
|
|
const hideMessage = message.loading('正在编译主题!', 0); |
|
|
|
function buildIt() { |
|
|
|
if (!window.less) { |
|
|
|
return; |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
window.less |
|
|
|
.modifyVars({ |
|
|
|
'@primary-color': primaryColor, |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
hideMessage(); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
message.error('Failed to update theme'); |
|
|
|
hideMessage(); |
|
|
|
}); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
if (!lessNodesAppended) { |
|
|
|
const lessStyleNode = document.createElement('link'); |
|
|
|
const lessConfigNode = document.createElement('script'); |
|
|
|
@ -38,24 +56,6 @@ const updateTheme = primaryColor => { |
|
|
|
} else { |
|
|
|
buildIt(); |
|
|
|
} |
|
|
|
function buildIt() { |
|
|
|
if (!window.less) { |
|
|
|
return; |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
window.less |
|
|
|
.modifyVars({ |
|
|
|
'@primary-color': primaryColor, |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
hideMessage(); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
message.error('Failed to update theme'); |
|
|
|
hideMessage(); |
|
|
|
}); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const updateColorWeak = colorWeak => { |
|
|
|
|