From ea7735839faaec2a461325adbbba1b9e5b162e8e Mon Sep 17 00:00:00 2001 From: yoon Date: Fri, 28 Feb 2025 14:05:27 +0900 Subject: [PATCH] =?UTF-8?q?@input=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/input/FormInput.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); + } +};