diff --git a/src/layout/components/lay-tag/index.vue b/src/layout/components/lay-tag/index.vue index 60a0133..29d0c36 100644 --- a/src/layout/components/lay-tag/index.vue +++ b/src/layout/components/lay-tag/index.vue @@ -36,6 +36,7 @@ const { buttonLeft, showModel, translateX, + isFixedTag, pureSetting, activeIndex, getTabStyle, @@ -576,7 +577,7 @@ onBeforeUnmount(() => { 'scroll-item is-closable', linkIsActive(item), showModel === 'chrome' && 'chrome-item', - !isAllEmpty(item?.meta?.fixedTag) && 'fixed-tag' + isFixedTag(item) && 'fixed-tag' ]" @contextmenu.prevent="openMenu(item, $event)" @mouseenter.prevent="onMouseenter(index)" @@ -591,10 +592,10 @@ onBeforeUnmount(() => { { {{ item.meta.title }} diff --git a/src/layout/hooks/useTag.ts b/src/layout/hooks/useTag.ts index aba5622..9a9562a 100644 --- a/src/layout/hooks/useTag.ts +++ b/src/layout/hooks/useTag.ts @@ -124,6 +124,12 @@ export function useTags() { } } + const isFixedTag = computed(() => { + return item => { + return isBoolean(item?.meta?.fixedTag) && item?.meta?.fixedTag === true; + }; + }); + const iconIsActive = computed(() => { return (item, index) => { if (index === 0) return; @@ -220,6 +226,7 @@ export function useTags() { buttonTop, buttonLeft, translateX, + isFixedTag, pureSetting, activeIndex, getTabStyle, diff --git a/src/plugins/elementPlus.ts b/src/plugins/elementPlus.ts index 2ff3b5b..8363187 100644 --- a/src/plugins/elementPlus.ts +++ b/src/plugins/elementPlus.ts @@ -107,6 +107,7 @@ import { ElWatermark, ElTour, ElTourStep, + ElSegmented, /** * 为了方便演示平台将 element-plus 导出的所有插件引入,实际使用中如果你没用到哪个插件,将其注释掉就行 * 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/plugin.ts#L11-L16 @@ -221,7 +222,8 @@ const components = [ ElUpload, ElWatermark, ElTour, - ElTourStep + ElTourStep, + ElSegmented ]; const plugins = [ diff --git a/types/global-components.d.ts b/types/global-components.d.ts index fc8f56a..71314d4 100644 --- a/types/global-components.d.ts +++ b/types/global-components.d.ts @@ -115,6 +115,7 @@ declare module "vue" { ElWatermark: (typeof import("element-plus"))["ElWatermark"]; ElTour: (typeof import("element-plus"))["ElTour"]; ElTourStep: (typeof import("element-plus"))["ElTourStep"]; + ElSegmented: (typeof import("element-plus"))["ElSegmented"]; } interface ComponentCustomProperties {