diff --git a/src/models/setting.js b/src/models/setting.js index b06e95e2aba312ab3597ce5cae5a83a8d49776bb..0feaa9085ba44470d1464c7a9f21d05054c6f51a 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -33,6 +33,7 @@ const updateTheme = primaryColor => { }, 200); } if (!lessNodesAppended) { + // insert less.js and color.less const lessStyleNode = document.createElement('link'); const lessConfigNode = document.createElement('script'); const lessScriptNode = document.createElement('script'); @@ -106,10 +107,13 @@ export default { urlParams.searchParams.set(key, value); } }); - const { primaryColor, colorWeak } = payload; + const { primaryColor, colorWeak, contentWidth } = payload; if (state.primaryColor !== primaryColor) { updateTheme(primaryColor); } + if (state.contentWidth !== contentWidth) { + window.dispatchEvent ? window.dispatchEvent(new Event('resize')) : null; + } updateColorWeak(colorWeak); window.history.replaceState(null, 'setting', urlParams.href); return {