From e09f654abaed8feb053d9ee16c549f25903707b9 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 13 Aug 2025 00:55:35 +0900 Subject: [PATCH] =?UTF-8?q?fix(character-form):=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=AA=A8=EB=93=9C=EC=97=90=EC=84=9C=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=82=AC=ED=95=AD=EB=A7=8C=20=EC=9E=88=EC=9C=BC=EB=A9=B4=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EB=B2=84=ED=8A=BC=20=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - isSaveDisabled 로직을 등록/수정 모드로 분리 - 수정(edit) 모드에서는 필수값 유효성과 무관하게 변경 감지 시 버튼 활성화 - 등록(create) 모드에서는 기존대로 폼 유효성으로 활성화 판단 - saveCharacter에서도 등록 모드에서만 필수값 유효성 검사를 강제하도록 수정 관련 파일: src/views/Chat/CharacterForm.vue --- src/views/Chat/CharacterForm.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/views/Chat/CharacterForm.vue b/src/views/Chat/CharacterForm.vue index e2dd4b1..a8e6df1 100644 --- a/src/views/Chat/CharacterForm.vue +++ b/src/views/Chat/CharacterForm.vue @@ -1014,10 +1014,12 @@ export default { computed: { isSaveDisabled() { if (this.isLoading) return true; - if (!this.isFormValid) return true; - if (!this.isEdit) return false; // 등록 시에는 변경 감지 없이 유효성만 확인 + // 등록(create) 모드에서는 폼 유효성으로 판단 + if (!this.isEdit) { + return !this.isFormValid; + } - // 수정 시에는 변경 사항이 있는 경우에만 저장 가능 + // 수정(edit) 모드에서는 변경 사항이 있는지만 판단(필수값 유효성과 무관) const changed = this.getChangedFields(); const hasNonIdField = Object.keys(changed || {}).some(k => k !== 'id'); const imageChanged = !!this.character.image; // 새 이미지 선택 여부 @@ -1443,7 +1445,8 @@ export default { }, async saveCharacter() { - if (!this.isFormValid) { + // 등록(create) 모드에서만 필수값 유효성 검사를 강제 + if (!this.isEdit && !this.isFormValid) { this.notifyError("필수 항목을 모두 입력하세요"); return; }