From 8237adb9c0b187911df37d6d99fd84718bc3ea8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=87=95=E5=8D=9A=E6=96=87?= <349952469@qq.com> Date: Thu, 16 Jun 2022 10:00:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(tabs):=20=E5=A4=9A=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD=E6=89=80=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/TabDetail/components/ContextMenu.vue | 11 +++++++++++ src/store/modules/tab/index.ts | 4 ++++ src/utils/common/icon.ts | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/layouts/common/GlobalTab/components/TabDetail/components/ContextMenu.vue b/src/layouts/common/GlobalTab/components/TabDetail/components/ContextMenu.vue index fed6ddc6..e18651ff 100644 --- a/src/layouts/common/GlobalTab/components/TabDetail/components/ContextMenu.vue +++ b/src/layouts/common/GlobalTab/components/TabDetail/components/ContextMenu.vue @@ -86,6 +86,11 @@ const options = computed(() => [ label: '关闭右侧', key: 'close-right', icon: iconifyRender('mdi:format-horizontal-align-right') + }, + { + label: '关闭所有', + key: 'close-all', + icon: iconifyRender('ant-design:line-outlined') } ]); @@ -119,6 +124,12 @@ const actionMap = new Map void>([ () => { tab.clearRightTab(props.currentPath); } + ], + [ + 'close-all', + () => { + tab.clearAllTab(); + } ] ]); diff --git a/src/store/modules/tab/index.ts b/src/store/modules/tab/index.ts index d0be48e5..11898944 100644 --- a/src/store/modules/tab/index.ts +++ b/src/store/modules/tab/index.ts @@ -155,6 +155,10 @@ export const useTabStore = defineStore('tab-store', { this.clearTab(excludes); } }, + /** 清除所有多页签 */ + clearAllTab() { + this.clearTab(); + }, /** * 点击单个tab * @param fullPath - 路由fullPath diff --git a/src/utils/common/icon.ts b/src/utils/common/icon.ts index 69efbc16..db225dda 100644 --- a/src/utils/common/icon.ts +++ b/src/utils/common/icon.ts @@ -1,4 +1,5 @@ import { h } from 'vue'; +import { NIcon } from 'naive-ui'; import { Icon } from '@iconify/vue'; import SvgIcon from '@/components/custom/SvgIcon.vue'; @@ -16,7 +17,7 @@ export function iconifyRender(icon: string, color?: string, size?: number) { if (size) { style.size = `${size}px`; } - return () => h(Icon, { icon, style }); + return () => h(NIcon, null, { default: () => h(Icon, { icon, style }) }); } /** From 0523f0838246041bfc09130e21369bd777f63682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=87=95=E5=8D=9A=E6=96=87?= <349952469@qq.com> Date: Thu, 16 Jun 2022 11:07:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(svg-icon):=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=9B=BE=E6=A0=87=E5=9C=A8Dropdown=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8Bhover=E7=8A=B6=E6=80=81=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/custom/SvgIcon.vue | 2 +- src/utils/common/icon.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/custom/SvgIcon.vue b/src/components/custom/SvgIcon.vue index d3dc9fd8..0546aedc 100644 --- a/src/components/custom/SvgIcon.vue +++ b/src/components/custom/SvgIcon.vue @@ -1,5 +1,5 @@ diff --git a/src/utils/common/icon.ts b/src/utils/common/icon.ts index db225dda..689d7748 100644 --- a/src/utils/common/icon.ts +++ b/src/utils/common/icon.ts @@ -35,5 +35,5 @@ export function customIconRender(icon: string, color?: string, size?: number) { style.size = `${size}px`; } - return () => h(SvgIcon, { icon, style }); + return () => h(NIcon, null, { default: () => h(SvgIcon, { icon, style }) }); }