mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(design): tabs支持modelValue
This commit is contained in:
parent
a4f9467d53
commit
47e851ce5e
@ -5,6 +5,7 @@
|
|||||||
@tab-click="tabClickHandler"
|
@tab-click="tabClickHandler"
|
||||||
@tab-add="onTabAdd"
|
@tab-add="onTabAdd"
|
||||||
@tab-remove="onTabRemove"
|
@tab-remove="onTabRemove"
|
||||||
|
@update:model-value="updateModelName"
|
||||||
>
|
>
|
||||||
<template #default>
|
<template #default>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
@ -21,13 +22,14 @@ const props = defineProps<{
|
|||||||
type?: string;
|
type?: string;
|
||||||
editable?: boolean;
|
editable?: boolean;
|
||||||
tabPosition?: string;
|
tabPosition?: string;
|
||||||
|
modelValue?: string | number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const uiComponent = getConfig('components').tabs;
|
const uiComponent = getConfig('components').tabs;
|
||||||
|
|
||||||
const uiProps = computed(() => uiComponent.props(props));
|
const uiProps = computed(() => uiComponent.props(props));
|
||||||
|
|
||||||
const emit = defineEmits(['tab-click', 'tab-add', 'tab-remove']);
|
const emit = defineEmits(['tab-click', 'tab-add', 'tab-remove', 'update:model-value']);
|
||||||
|
|
||||||
const tabClickHandler = (...args: any[]) => {
|
const tabClickHandler = (...args: any[]) => {
|
||||||
emit('tab-click', ...args);
|
emit('tab-click', ...args);
|
||||||
@ -40,4 +42,8 @@ const onTabAdd = (...args: any[]) => {
|
|||||||
const onTabRemove = (...args: any[]) => {
|
const onTabRemove = (...args: any[]) => {
|
||||||
emit('tab-remove', ...args);
|
emit('tab-remove', ...args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateModelName = (...args: any[]) => {
|
||||||
|
emit('update:model-value', ...args);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user