@input 추가
This commit is contained in:
parent
e07593c13b
commit
ea7735839f
@ -15,6 +15,7 @@
|
|||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:min="min"
|
:min="min"
|
||||||
@focusout="$emit('focusout', modelValue)"
|
@focusout="$emit('focusout', modelValue)"
|
||||||
|
@input="handleInput"
|
||||||
/>
|
/>
|
||||||
<div class="invalid-feedback" :class="isAlert ? 'd-block' : ''">
|
<div class="invalid-feedback" :class="isAlert ? 'd-block' : ''">
|
||||||
{{ title }}을 확인해주세요.
|
{{ title }}을 확인해주세요.
|
||||||
@ -92,11 +93,6 @@ const inputValue = ref(props.modelValue);
|
|||||||
// 부모로 데이터 업데이트
|
// 부모로 데이터 업데이트
|
||||||
watch(inputValue, (newValue) => {
|
watch(inputValue, (newValue) => {
|
||||||
emits('update:modelValue', 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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user