From 555d8984d6249133e8bc9d74c37bf9957d8ace2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 6 Sep 2018 10:09:19 +0800 Subject: [PATCH] fix #2193 width modification needs to trigger resize --- src/models/setting.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/models/setting.js b/src/models/setting.js index b06e95e2..0feaa908 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 { -- GitLab