From a4ee6ba0ca28833cbbb8cf0e675561b10fa4c1af Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 12 九月 2024 01:23:40 +0800 Subject: [PATCH] 规则维护更新 --- src/layouts/default/tabs/components/TabContent.vue | 85 ++++++++++++++++++------------------------ 1 files changed, 36 insertions(+), 49 deletions(-) diff --git a/src/layouts/default/tabs/components/TabContent.vue b/src/layouts/default/tabs/components/TabContent.vue index 431cbb1..c7b42b2 100644 --- a/src/layouts/default/tabs/components/TabContent.vue +++ b/src/layouts/default/tabs/components/TabContent.vue @@ -2,7 +2,7 @@ <Dropdown :dropMenuList="getDropMenuList" :trigger="getTrigger" - placement="bottom" + placement="bottomLeft" overlayClassName="multiple-tabs__dropdown" @menu-event="handleMenuEvent" > @@ -14,63 +14,50 @@ </span> </Dropdown> </template> -<script lang="ts"> +<script lang="ts" setup> import type { PropType } from 'vue'; import type { RouteLocationNormalized } from 'vue-router'; - import { defineComponent, computed, unref } from 'vue'; - import { Dropdown } from '/@/components/Dropdown/index'; + import { computed, unref } from 'vue'; + import { Dropdown } from '@/components/Dropdown'; import Icon from '@/components/Icon/Icon.vue'; import { TabContentProps } from '../types'; - import { useDesign } from '/@/hooks/web/useDesign'; - import { useI18n } from '/@/hooks/web/useI18n'; + import { useDesign } from '@/hooks/web/useDesign'; + import { useI18n } from '@/hooks/web/useI18n'; import { useTabDropdown } from '../useTabDropdown'; - export default defineComponent({ - name: 'TabContent', - components: { Dropdown, Icon }, - props: { - tabItem: { - type: Object as PropType<RouteLocationNormalized>, - default: null, - }, - isExtra: Boolean, + defineOptions({ name: 'TabContent' }); + + const props = defineProps({ + tabItem: { + type: Object as PropType<RouteLocationNormalized>, + default: null, }, - setup(props) { - const { prefixCls } = useDesign('multiple-tabs-content'); - const { t } = useI18n(); - - const getTitle = computed(() => { - const { tabItem: { meta } = {} } = props; - return meta && t(meta.title as string); - }); - - const getIsTabs = computed(() => !props.isExtra); - - const getTrigger = computed((): ('contextmenu' | 'click' | 'hover')[] => - unref(getIsTabs) ? ['contextmenu'] : ['click'], - ); - - const { getDropMenuList, handleMenuEvent, handleContextMenu } = useTabDropdown( - props as TabContentProps, - getIsTabs, - ); - - function handleContext(e) { - props.tabItem && handleContextMenu(props.tabItem)(e); - } - - return { - prefixCls, - getDropMenuList, - handleMenuEvent, - handleContext, - getTrigger, - getIsTabs, - getTitle, - }; - }, + isExtra: Boolean, }); + + const { prefixCls } = useDesign('multiple-tabs-content'); + const { t } = useI18n(); + + const getTitle = computed(() => { + const { tabItem: { meta } = {} } = props; + return meta && t(meta.title as string); + }); + + const getIsTabs = computed(() => !props.isExtra); + + const getTrigger = computed((): ('contextmenu' | 'click' | 'hover')[] => + unref(getIsTabs) ? ['contextmenu'] : ['click'], + ); + + const { getDropMenuList, handleMenuEvent, handleContextMenu } = useTabDropdown( + props as TabContentProps, + getIsTabs, + ); + + function handleContext(e) { + props.tabItem && handleContextMenu(props.tabItem)(e); + } </script> -- Gitblit v1.9.3