From d395f03a57a9265f1d39b3220fc7c9b983efee30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=87=AF=E9=BE=99?= <502431556@qq.com> Date: Thu, 14 Apr 2022 10:37:13 +0800 Subject: [PATCH] perf: add tagsViewIcon setting --- src/components/Setting/src/Setting.vue | 2 ++ .../Setting/src/components/InterfaceDisplay.vue | 12 ++++++++++++ src/components/TagsView/src/TagsView.vue | 17 +++++++++++++++++ src/config/app.ts | 2 ++ src/layout/components/useRenderLayout.tsx | 8 ++++---- src/locales/en.ts | 3 ++- src/locales/zh-CN.ts | 3 ++- src/store/modules/app.ts | 6 ++++++ 8 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/components/Setting/src/Setting.vue b/src/components/Setting/src/Setting.vue index 94d328f..2fa2121 100644 --- a/src/components/Setting/src/Setting.vue +++ b/src/components/Setting/src/Setting.vue @@ -128,6 +128,8 @@ const copyConfig = async () => { locale: ${appStore.getLocale}, // 标签页 tagsView: ${appStore.getTagsView}, + // 标签页图标 + getTagsViewIcon: ${appStore.getTagsViewIcon}, // logo logo: ${appStore.getLogo}, // 菜单手风琴 diff --git a/src/components/Setting/src/components/InterfaceDisplay.vue b/src/components/Setting/src/components/InterfaceDisplay.vue index bc3749c..8112e9a 100644 --- a/src/components/Setting/src/components/InterfaceDisplay.vue +++ b/src/components/Setting/src/components/InterfaceDisplay.vue @@ -65,6 +65,13 @@ const tagsViewChange = (show: boolean) => { appStore.setTagsView(show) } +// 标签页图标 +const tagsViewIcon = ref(appStore.getTagsViewIcon) + +const tagsViewIconChange = (show: boolean) => { + appStore.setTagsViewIcon(show) +} + // logo const logo = ref(appStore.getLogo) @@ -149,6 +156,11 @@ watch( +
+ {{ t('setting.tagsViewIcon') }} + +
+
{{ t('setting.logo') }} diff --git a/src/components/TagsView/src/TagsView.vue b/src/components/TagsView/src/TagsView.vue index c10a54a..5e3379d 100644 --- a/src/components/TagsView/src/TagsView.vue +++ b/src/components/TagsView/src/TagsView.vue @@ -4,6 +4,7 @@ import { useRouter } from 'vue-router' import type { RouteLocationNormalizedLoaded, RouterLinkProps } from 'vue-router' import { usePermissionStore } from '@/store/modules/permission' import { useTagsViewStore } from '@/store/modules/tagsView' +import { useAppStore } from '@/store/modules/app' import { useI18n } from '@/hooks/web/useI18n' import { filterAffixTags } from './helper' import { ContextMenu, ContextMenuExpose } from '@/components/ContextMenu' @@ -30,6 +31,10 @@ const visitedViews = computed(() => tagsViewStore.getVisitedViews) const affixTagArr = ref([]) +const appStore = useAppStore() + +const tagsViewIcon = computed(() => appStore.getTagsViewIcon) + // 初始化tag const initTags = () => { affixTagArr.value = filterAffixTags(unref(routers)) @@ -341,6 +346,17 @@ watch( @click="navigate" class="h-full flex justify-center items-center whitespace-nowrap pl-15px" > + {{ t(item?.meta?.title as string) }} { {tagsView.value ? ( - + ) : undefined}
@@ -139,7 +139,7 @@ export const useRenderLayout = () => { {tagsView.value ? ( { {tagsView.value ? ( { {tagsView.value ? (