From a4afc54f2ef9d75dbc7d9b61d56288578a1e6d1d Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 22 Aug 2024 14:20:48 +0700 Subject: [PATCH] fix: backward compatible --- src/components/form/AddressForm.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/form/AddressForm.vue b/src/components/form/AddressForm.vue index ad70e9d2..735b9415 100644 --- a/src/components/form/AddressForm.vue +++ b/src/components/form/AddressForm.vue @@ -103,6 +103,14 @@ async function fetchSubDistrict() { ); } +async function selectSubDistrict(id: string) { + if (!id) return; + zipCode.value = + addrOptions.subDistrictOps + ?.filter((x) => x.id === id) + .map((x) => x.zipCode)[0] ?? ''; +} + const provinceOptions = ref[]>([]); let provinceFilter: ( value: string, @@ -355,6 +363,7 @@ watch(districtId, fetchSubDistrict); $t('formDialogInputSubDistrictValidate'), ] " + @update:model-value="(v: string) => selectSubDistrict(v)" @filter="subDistrictFilter" >