Fix default address switch state

This commit is contained in:
marzban-dev
2026-04-23 20:35:27 +03:30
parent 373b7308d4
commit fb3425fd0b
2 changed files with 8 additions and 5 deletions
@@ -40,7 +40,7 @@ const addressData = ref({
address: address.value?.address ?? "", address: address.value?.address ?? "",
name: address.value?.name ?? "", name: address.value?.name ?? "",
phone: address.value?.phone ?? "", 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, 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], () => [addressData.value.for_me, isShow.value],
([newValue, newValue2]) => { ([newValue, newValue2]) => {
if (!isEditing.value) { if (!isEditing.value) {
addressData.value.phone = newValue == "بله" && newValue2 ? account.value?.phone ?? "" : ""; addressData.value.phone = newValue == "بله" && newValue2 ? (account.value?.phone ?? "") : "";
} }
}, },
{ {
immediate: true, immediate: true,
} },
); );
</script> </script>
@@ -283,6 +283,9 @@ watch(
> >
به عنوان آدرس پیش فرض ثبت شود؟ به عنوان آدرس پیش فرض ثبت شود؟
</label> </label>
<!-- {{ address?.is_main }} -->
<Switch <Switch
id="is_main" id="is_main"
v-model="addressData.is_main" v-model="addressData.is_main"
+1 -1
View File
@@ -22,7 +22,7 @@ const emit = defineEmits<Emits>();
// computed // computed
const value = computed({ const value = computed({
get: () => (modelValue.value == "true" ? true : false), get: () => modelValue.value,
set: (value) => { set: (value) => {
emit("update:modelValue", value); emit("update:modelValue", value);
}, },