feat: 快速预定的处理

This commit is contained in:
2026-03-20 00:25:12 +08:00
parent b7d9ebf816
commit 14d2ad7b53
2 changed files with 26 additions and 14 deletions

View File

@@ -61,8 +61,12 @@ const tabList = ref([]);
// 处理Tab点击
const handleTabClick = (index) => {
if (activeIndex.value === index) return;
changeTabItem(index);
};
// 支持 force 参数,强制触发(即使 index 与当前相同)
const changeTabItem = (index, force = false) => {
if (!force && activeIndex.value === index) return;
activeIndex.value = index;
emit("change", {
@@ -70,7 +74,8 @@ const handleTabClick = (index) => {
item: tabList.value[index],
});
emit("update:modelValue", index);
};
}
// 监听tabs变化
watch(
@@ -114,6 +119,12 @@ const getCommodityTypePageList = async () => {
} else {
tabList.value = props.tabs;
}
// 加载完成后强制选中第一个项并通知外部
if (tabList.value && tabList.value.length > 0) {
changeTabItem(0, true);
} else {
changeTabItem(props.defaultActive, true);
}
};
</script>