From 41a1a18aa23dfc16811026b0a17cba7d6844e232 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Thu, 6 Jun 2024 13:56:38 +0700 Subject: [PATCH] fix: delete tab on add customer --- src/components/TabComponent.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/TabComponent.vue b/src/components/TabComponent.vue index 6a0cf7b3..35c248e7 100644 --- a/src/components/TabComponent.vue +++ b/src/components/TabComponent.vue @@ -37,8 +37,11 @@ function addData() { } function close(index: number) { - console.log(customerBranch.value.length, index); - if (customerBranch.value.length - 1 === index) { + if (customerBranch.value.length === 1) return; + + if (customerBranch.value.length === index + 1) { + tab.value = tab.value - 1; + } else if (tab.value >= index) { tab.value = tab.value - 1; } @@ -66,7 +69,7 @@ function close(index: number) { :key="index" :name="index" :label="`${$t('customerBranchFormTab')} ${index + 1}`" - @click="tab = index" + @click="(tab = index), console.log(customerBranch)" no-caps >