diff --git a/src/components/input/FormInput.vue b/src/components/input/FormInput.vue index a51c16c..d1ad6fd 100644 --- a/src/components/input/FormInput.vue +++ b/src/components/input/FormInput.vue @@ -15,6 +15,7 @@ :disabled="disabled" :min="min" @focusout="$emit('focusout', modelValue)" + @input="handleInput" />
{{ title }}을 확인해주세요. @@ -92,11 +93,6 @@ const inputValue = ref(props.modelValue); // 부모로 데이터 업데이트 watch(inputValue, (newValue) => { emits('update:modelValue', newValue); - - // 값이 입력될 때 `alert`를 false로 설정 - if (newValue.trim() !== '') { - emits('update:alert', false); - } }); // 초기값 동기화 @@ -106,6 +102,13 @@ watch(() => props.modelValue, (newValue) => { } }); +const handleInput = (event) => { + const newValue = event.target.value.slice(0, props.maxlength); + + if (newValue.trim() !== '') { + emits('update:alert', false); + } +};