This commit is contained in:
2024-09-24 17:04:44 +08:00
parent 6cd84e0021
commit 30528311c1
77 changed files with 2251 additions and 1361 deletions

View File

@@ -63,11 +63,14 @@ const _sfc_main = defineComponent({
const removeItem = (id) => {
tabMap.delete(id);
};
provide(TabInjectKey, reactive({
active,
addItem,
removeItem
}));
provide(
TabInjectKey,
reactive({
active,
addItem,
removeItem
})
);
const change = function(id) {
if (props.beforeLeave && props.beforeLeave(id) === false) {
return;
@@ -263,19 +266,26 @@ const _sfc_main = defineComponent({
}
};
useResizeObserver(navRef, update);
watch(tabMap, () => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
}, { immediate: true });
watch(() => [
props.modelValue,
props.tabPosition,
props.type,
childrens.value.length
], async () => {
await nextTick();
update();
});
watch(
tabMap,
() => {
childrens.value = [];
setItemInstanceBySlot(slot.default && slot.default());
},
{ immediate: true }
);
watch(
() => [
props.modelValue,
props.tabPosition,
props.type,
childrens.value.length
],
async () => {
await nextTick();
update();
}
);
onMounted(() => {
update();
scrollToActiveTab();