changed input defaults
This commit is contained in:
@@ -5,15 +5,17 @@ type Props = {
|
||||
error?: boolean;
|
||||
message?: string;
|
||||
placeholder?: string;
|
||||
modelValue?: string;
|
||||
modelValue: string;
|
||||
};
|
||||
|
||||
// props
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
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<HTMLInputElement | null>(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);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -51,8 +52,7 @@ const onInput = (e: any) => {
|
||||
<slot name="startItem" />
|
||||
|
||||
<input
|
||||
:value="modelValue"
|
||||
@input="onInput"
|
||||
v-model="value"
|
||||
ref="inputRef"
|
||||
class="outline-none flex-1 text-sm placeholder-slate-400"
|
||||
:placeholder="placeholder"
|
||||
|
||||
Reference in New Issue
Block a user