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" >