From 4925f0d0641ca87c0ae38f976b10b0114cb2c93a Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Sat, 8 Feb 2025 23:47:35 +0330 Subject: [PATCH] changed input defaults --- frontend/components/global/Input.vue | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/components/global/Input.vue b/frontend/components/global/Input.vue index 7481b6b..f467f30 100644 --- a/frontend/components/global/Input.vue +++ b/frontend/components/global/Input.vue @@ -5,15 +5,17 @@ type Props = { error?: boolean; message?: string; placeholder?: string; - modelValue?: string; + modelValue: string; }; // props const props = withDefaults(defineProps(), { variant: "solid", + disabled: false, + placeholder: "وارد نشده", }); -const { variant, message, error, disabled } = toRefs(props); +const { variant, message, error, disabled, modelValue } = toRefs(props); // emits @@ -25,6 +27,11 @@ const inputRef = ref(null); // computed +const value = computed({ + get: () => modelValue.value ?? "", + set: (value) => emit("update:modelValue", value), +}); + const classes = computed(() => { return [ "flex items-center text-black justify-between cursor-text transition-all border-[1.5px] gap-3 typo-label-md px-4 py-3.5 selection:bg-slate-100 rounded-100", @@ -38,12 +45,6 @@ const classes = computed(() => { }, ]; }); - -// methods - -const onInput = (e: any) => { - emit("update:modelValue", e.target.value); -};