From 2382dd8abcaf44715085bcfb82e4d07f90d47ee3 Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Tue, 23 Jun 2020 18:57:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20components's=20style=20overlay=20problem?= =?UTF-8?q?=20when=20toggle=20theme=20color.=20(=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E8=89=B2=E6=97=B6=E7=BB=84=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=A6=86=E7=9B=96=E9=97=AE=E9=A2=98=E3=80=82)=20fixes?= =?UTF-8?q?=20#78?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/themeUtil.js | 24 ++++++++++++++++++++++++ vue.config.js | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/utils/themeUtil.js b/src/utils/themeUtil.js index 279e0f8..ffe0a3b 100644 --- a/src/utils/themeUtil.js +++ b/src/utils/themeUtil.js @@ -23,5 +23,29 @@ module.exports = { let promise = client.changer.changeColor(options) this.lastColor = lastColor return promise + }, + changeSelector (selector) { + switch (selector) { + case '.ant-calendar-today .ant-calendar-date': + return ':not(.ant-calendar-selected-date):not(.ant-calendar-selected-day)' + selector + case '.ant-btn:focus,.ant-btn:hover': + return '.ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger),.ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger)' + case '.ant-btn.active,.ant-btn:active': + return '.ant-btn.active:not(.ant-btn-primary):not(.ant-btn-danger),.ant-btn:active:not(.ant-btn-primary):not(.ant-btn-danger)' + case '.ant-steps-item-process .ant-steps-item-icon > .ant-steps-icon': + case '.ant-steps-item-process .ant-steps-item-icon>.ant-steps-icon': + return ':not(.ant-steps-item-process)' + selector + case '.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-submenu-selected,.ant-menu-horizontal>.ant-menu-submenu:hover': + case '.ant-menu-horizontal > .ant-menu-item-active,.ant-menu-horizontal > .ant-menu-item-open,.ant-menu-horizontal > .ant-menu-item-selected,.ant-menu-horizontal > .ant-menu-item:hover,.ant-menu-horizontal > .ant-menu-submenu-active,.ant-menu-horizontal > .ant-menu-submenu-open,.ant-menu-horizontal > .ant-menu-submenu-selected,.ant-menu-horizontal > .ant-menu-submenu:hover': + return '.ant-menu-horizontal > .ant-menu-item-active,.ant-menu-horizontal > .ant-menu-item-open,.ant-menu-horizontal > .ant-menu-item-selected,.ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-item:hover,.ant-menu-horizontal > .ant-menu-submenu-active,.ant-menu-horizontal > .ant-menu-submenu-open,.ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu-selected,.ant-menu-horizontal:not(.ant-menu-dark) > .ant-menu-submenu:hover' + case '.ant-menu-horizontal > .ant-menu-item-selected > a': + case '.ant-menu-horizontal>.ant-menu-item-selected>a': + return '.ant-menu-horizontal:not(ant-menu-light):not(.ant-menu-dark) > .ant-menu-item-selected > a' + case '.ant-menu-horizontal > .ant-menu-item > a:hover': + case '.ant-menu-horizontal>.ant-menu-item>a:hover': + return '.ant-menu-horizontal:not(ant-menu-light):not(.ant-menu-dark) > .ant-menu-item > a:hover' + default : + return selector + } } } diff --git a/vue.config.js b/vue.config.js index 934696d..a78f965 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ let path = require('path') const ThemeColorReplacer = require('webpack-theme-color-replacer') -const getThemeColors = require('./src/utils/themeUtil').getThemeColors +const {getThemeColors, changeSelector} = require('./src/utils/themeUtil') const themeColor = require('./src/config').themeColor module.exports = { @@ -16,7 +16,8 @@ module.exports = { config.plugins.push( new ThemeColorReplacer({ fileName: 'css/theme-colors.css', - matchColors: getThemeColors(themeColor) + matchColors: getThemeColors(themeColor), + changeSelector }) ) },