diff --git a/src/components/user/RegisterForm.vue b/src/components/user/RegisterForm.vue index aea85d2..726df69 100644 --- a/src/components/user/RegisterForm.vue +++ b/src/components/user/RegisterForm.vue @@ -332,9 +332,12 @@ }; watch(password, (newValue) => { - if (newValue.length >= 4) { + if (newValue && newValue.length >= 4) { passwordErrorAlert.value = false; passwordError.value = ''; + } else if (newValue && newValue.length < 4) { + passwordErrorAlert.value = true; + passwordError.value = '비밀번호는 4자리 이상이어야 합니다.'; } }); @@ -342,6 +345,7 @@ // 회원가입 const handleSubmit = async () => { await checkColorDuplicate(); + idAlert.value = id.value.trim() === ''; passwordAlert.value = password.value.trim() === ''; passwordcheckAlert.value = passwordcheck.value.trim() === ''; @@ -351,8 +355,8 @@ addressAlert.value = address.value.trim() === ''; phoneAlert.value = phone.value.trim() === ''; - // 비밀번호 길이 체크 로직 추가 - if (password.value.length < 4) { + // 비밀번호 길이 체크 로직 수정 + if (password.value && password.value.length < 4) { passwordErrorAlert.value = true; passwordError.value = '비밀번호는 4자리 이상이어야 합니다.'; } else {