vben
authored
|
18
19
20
21
22
23
24
25
26
27
|
import { TabContentProps, TabContentEnum } from '../types';
import { useDesign } from '/@/hooks/web/useDesign';
import { useTabDropdown } from '../useTabDropdown';
import { useI18n } from '/@/hooks/web/useI18n';
import { RouteLocationNormalized } from 'vue-router';
export default defineComponent({
name: 'TabContent',
|
vben
authored
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
props: {
tabItem: {
type: Object as PropType<RouteLocationNormalized>,
default: null,
},
type: {
type: Number as PropType<TabContentEnum>,
default: TabContentEnum.TAB_TYPE,
},
},
setup(props) {
const { prefixCls } = useDesign('multiple-tabs-content');
const { t } = useI18n();
const getTitle = computed(() => {
const { tabItem: { meta } = {} } = props;
return meta && t(meta.title);
});
const {
getDropMenuList,
handleMenuEvent,
handleContextMenu,
getTrigger,
isTabs,
} = useTabDropdown(props as TabContentProps);
function handleContext(e: ChangeEvent) {
props.tabItem && handleContextMenu(props.tabItem)(e);
}
return {
prefixCls,
getDropMenuList,
handleMenuEvent,
handleContext,
getTrigger,
isTabs,
getTitle,
};
},
});
</script>
|