update:alert 추가

This commit is contained in:
yoon 2025-02-27 09:17:27 +09:00
parent 7e484c12be
commit a7c27a19e4

View File

@ -14,7 +14,7 @@
:placeholder="title"
:disabled="disabled"
:min="min"
@focusout="$emit('focusout', modelValue)"
@focusout="$emit('focusout', modelValue)"
/>
<div class="invalid-feedback" :class="isAlert ? 'display-block' : ''">
{{ 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;
}
});
</script>
<style>
.none {
display: none;
}
</style>