From cfd334a4b4adf214c468df9599293361c3848f5b Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Wed, 8 Jul 2020 23:00:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20style=20problem=20of=20checkbox=20compon?= =?UTF-8?q?ent=20when=20switching=20themes;=20:bug:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E5=88=87=E6=8D=A2=E4=B8=BB=E9=A2=98=E6=97=B6=20checkb?= =?UTF-8?q?ox=20=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/replacer/resolve.config.js | 7 ++++++- src/utils/theme-color-replacer-extend.js | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/config/replacer/resolve.config.js b/src/config/replacer/resolve.config.js index b3c49de..6156725 100644 --- a/src/config/replacer/resolve.config.js +++ b/src/config/replacer/resolve.config.js @@ -13,7 +13,12 @@ * 注意: value 不能设置为 true */ const cssResolve = { - '.ant-checkbox-checked .ant-checkbox-inner::after': false, + '.ant-checkbox-checked .ant-checkbox-inner::after': { + resolve(cssText, cssObj) { + cssObj.rules.push('border-top:0', 'border-left:0') + return cssObj.toText() + } + }, '.ant-menu-dark .ant-menu-inline.ant-menu-sub': { resolve(cssText, cssObj) { cssObj.rules = cssObj.rules.filter(rule => rule.indexOf('box-shadow') == -1) diff --git a/src/utils/theme-color-replacer-extend.js b/src/utils/theme-color-replacer-extend.js index 7e586dc..8dadc35 100644 --- a/src/utils/theme-color-replacer-extend.js +++ b/src/utils/theme-color-replacer-extend.js @@ -26,8 +26,11 @@ function resolveCss(output, srcArr) { // 转换为 css 对象 let cssObj = parseCssObj(text) // 根据selector匹配配置,匹配成功,则按配置处理 css - if (cssResolve[cssObj.selector]) { - outArr.push(cssResolve[cssObj.selector].resolve(text, cssObj)) + if (cssResolve[cssObj.selector] != undefined) { + let cfg = cssResolve[cssObj.selector] + if (cfg) { + outArr.push(cfg.resolve(text, cssObj)) + } } else { let cssText = '' // 匹配不成功,则测试是否有匹配的正则配置,有则按正则对应的配置处理