Fix default address switch state
This commit is contained in:
@@ -40,7 +40,7 @@ const addressData = ref({
|
||||
address: address.value?.address ?? "",
|
||||
name: address.value?.name ?? "",
|
||||
phone: address.value?.phone ?? "",
|
||||
for_me: !isEditing.value ? address.value?.for_me ?? "بله" : address.value?.for_me == true ? "بله" : "خیر",
|
||||
for_me: !isEditing.value ? (address.value?.for_me ?? "بله") : address.value?.for_me == true ? "بله" : "خیر",
|
||||
is_main: address.value?.is_main ?? false,
|
||||
});
|
||||
|
||||
@@ -128,7 +128,7 @@ const handleSubmit = async () => {
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -137,12 +137,12 @@ watch(
|
||||
() => [addressData.value.for_me, isShow.value],
|
||||
([newValue, newValue2]) => {
|
||||
if (!isEditing.value) {
|
||||
addressData.value.phone = newValue == "بله" && newValue2 ? account.value?.phone ?? "" : "";
|
||||
addressData.value.phone = newValue == "بله" && newValue2 ? (account.value?.phone ?? "") : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -283,6 +283,9 @@ watch(
|
||||
>
|
||||
به عنوان آدرس پیش فرض ثبت شود؟
|
||||
</label>
|
||||
|
||||
<!-- {{ address?.is_main }} -->
|
||||
|
||||
<Switch
|
||||
id="is_main"
|
||||
v-model="addressData.is_main"
|
||||
|
||||
@@ -22,7 +22,7 @@ const emit = defineEmits<Emits>();
|
||||
// computed
|
||||
|
||||
const value = computed({
|
||||
get: () => (modelValue.value == "true" ? true : false),
|
||||
get: () => modelValue.value,
|
||||
set: (value) => {
|
||||
emit("update:modelValue", value);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user