diff --git a/src/components/input/FormInput.vue b/src/components/input/FormInput.vue index 62e3134..0e4f2f1 100644 --- a/src/components/input/FormInput.vue +++ b/src/components/input/FormInput.vue @@ -14,7 +14,7 @@ :placeholder="title" :disabled="disabled" :min="min" - @focusout="$emit('focusout', modelValue)" + @focusout="$emit('focusout', modelValue)" />
{{ title }}을 확인해주세요. @@ -82,7 +82,8 @@ const props = defineProps({ }); // Emits 정의 -const emits = defineEmits(['update:modelValue', 'focusout']); +const emits = defineEmits(['update:modelValue', 'focusout', 'update:alert']); + // 로컬 상태로 사용하기 위한 `inputValue` const inputValue = ref(props.modelValue); @@ -90,6 +91,11 @@ const inputValue = ref(props.modelValue); // 부모로 데이터 업데이트 watch(inputValue, (newValue) => { emits('update:modelValue', newValue); + + // 값이 입력될 때 `alert`를 false로 설정 + if (newValue.trim() !== '') { + emits('update:alert', false); + } }); // 초기값 동기화 @@ -98,10 +104,7 @@ watch(() => props.modelValue, (newValue) => { inputValue.value = newValue; } }); + + -