-
+
@@ -110,7 +110,7 @@ const props = defineProps({
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'submitEdit', 'cancelEdit']);
const password = ref('');
-
+const localEditedContent = ref(props.editedContent);
// 댓글 입력 창 토글
const isComment = ref(false);
@@ -142,16 +142,20 @@ const logPasswordAndEmit = () => {
emit('submitPassword', props.comment, password.value);
};
+
+watch(() => props.editedContent, (newValue) => {
+ localEditedContent.value = newValue;
+});
// 댓글 수정 취소
// const cancelEdit = () => {
// isEditTextarea.value = false;
// };
// 댓글 수정 내용 저장
-// const submitEdit = () => {
-// emit('submitComment', { commentId: props.comment.commentId, content: editedContent.value });
-// isEditTextarea.value = false; // 수정 모드 종료
-// };
+const submitEdit = () => {
+ emit('submitComment', { commentId: props.comment.commentId, content: editedContent.value });
+ isEditTextarea.value = false; // 수정 모드 종료
+};
diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue
index 76bb9a9..f4114ce 100644
--- a/src/views/board/BoardView.vue
+++ b/src/views/board/BoardView.vue
@@ -543,8 +543,8 @@ const submitCommentPassword = async (comment, password) => {
return;
}
- console.log('코멘트아이디:', comment.commentId, '비번:', password)
- comment.isEditTextarea = true;
+ // console.log('코멘트아이디:', comment.commentId, '비번:', password)
+ // comment.isEditTextarea = true;
//비밀번호 확인 안됨
try {
@@ -553,15 +553,15 @@ const submitCommentPassword = async (comment, password) => {
LOCCMTSEQ: comment.commentId,
});
- console.log("응답!!!!!!!!", response); // 서버 응답 전체 확인
- console.log("응답 데이터:", response.data);
+ // console.log("응답!!!!!!!!", response); // 서버 응답 전체 확인
+ // console.log("응답 데이터:", response.data);
if (response.data.code === 200 && response.data.data === true) {
console.log('되는거니')
// deleteComment()
- // // password.value = '';
- // // isPassword.value = false;
- // // isEditTextarea.value = true;
+ password.value = '';
+ isPassword.value = false;
+ comment.isEditTextarea.value = true;
} else {
passwordAlert.value = "비밀번호가 일치하지 않습니다.";
}