From 55ee6960e8803978bcef95901050f5cd5ed1d31d Mon Sep 17 00:00:00 2001 From: baimingxuan <354372738@qq.com> Date: Sun, 3 Mar 2024 22:07:35 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96Tag=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/tags/components/TagItem/index.module.less | 8 ++++++++ src/layout/tags/components/TagItem/index.tsx | 9 +++++++-- src/layout/tags/index.tsx | 8 ++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/layout/tags/components/TagItem/index.module.less b/src/layout/tags/components/TagItem/index.module.less index 686492e..c73c021 100644 --- a/src/layout/tags/components/TagItem/index.module.less +++ b/src/layout/tags/components/TagItem/index.module.less @@ -10,6 +10,14 @@ overflow: hidden; cursor: pointer; + &.is-dark-bg { + color: rgba(255, 255, 255, .65); + + svg { + color: rgba(255, 255, 255, .65); + } + } + &__dot { display: inline-block; width: 8px; diff --git a/src/layout/tags/components/TagItem/index.tsx b/src/layout/tags/components/TagItem/index.tsx index 099208e..21484d9 100644 --- a/src/layout/tags/components/TagItem/index.tsx +++ b/src/layout/tags/components/TagItem/index.tsx @@ -8,7 +8,8 @@ export default defineComponent({ props: { fixed: propTypes.bool, name: propTypes.string, - active: propTypes.bool + active: propTypes.bool, + isDarkBg: propTypes.bool }, setup(props, { emit }) { function handleClose() { @@ -17,7 +18,11 @@ export default defineComponent({ return () => ( diff --git a/src/layout/tags/index.tsx b/src/layout/tags/index.tsx index 0412dc3..2af3023 100644 --- a/src/layout/tags/index.tsx +++ b/src/layout/tags/index.tsx @@ -65,6 +65,13 @@ export default defineComponent({ return {} }) + const isDarkBg = computed( + () => + unref(getAppMode) === AppModeEnum.LIGHT && + unref(getMenuTheme) === ThemeEnum.DARK && + unref(getMenuType) === MenuTypeEnum.HEADER_MENU + ) + initAffixTags() listenerRouteChange(route => { @@ -183,6 +190,7 @@ export default defineComponent({ name={item.meta.title} active={unref(activeKeyRef) === item.path} fixed={item.meta?.affix} + isDarkBg={unref(isDarkBg)} onClick={() => handleClickTag(item.path)} onCloseTag={() => handleCloseTag(item.path)} />