From f7617e11a6ac0a9112cdd86c7fabed3612bb7863 Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Thu, 20 Feb 2025 15:12:12 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=A2=8B=EC=95=84?= =?UTF-8?q?=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardComment.vue | 74 +++++++++++---------- src/components/board/BoardCommentList.vue | 13 ++-- src/components/board/BoardProfile.vue | 5 +- src/components/button/BoardRecommendBtn.vue | 18 ++--- src/views/board/BoardView.vue | 54 ++++++++++++--- 5 files changed, 96 insertions(+), 68 deletions(-) diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index 2bdc346..a3de641 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -52,17 +52,6 @@ /> - - @@ -73,30 +62,30 @@ import BoardCommentArea from './BoardCommentArea.vue'; import PlusButton from '../button/PlusBtn.vue'; const props = defineProps({ - comment: { - type: Object, - required: true, - }, - unknown: { + comment: { + type: Object, + required: true, + }, + unknown: { + type: Boolean, + default: true, + }, + isPlusButton: { type: Boolean, default: true, }, - isPlusButton: { - type: Boolean, - default: true, - }, - isLike: { - type: Boolean, - default: false, - }, - isEditTextarea: { - type: Boolean, - default: false - }, - isPassword: { - type: Boolean, - default: false, -}, + isLike: { + type: Boolean, + default: false, + }, + isEditTextarea: { + type: Boolean, + default: false + }, + isPassword: { + type: Boolean, + default: false, + }, }); // emits 정의 @@ -117,11 +106,28 @@ const submitComment = (newComment) => { // 좋아요, 싫어요 const handleUpdateReaction = (reactionData) => { + // console.log('📌 BoardComment.vue에서 좋아요 이벤트 발생:', reactionData); + + // if (!reactionData.commentId) { + // console.log("⚠️ reactionData.commentId가 존재하지 않음! 이 값이 null이 되어 덮어씌워질 가능성이 있음."); + // } + + // console.log('🟢 BoardComment.vue의 props.comment:', props.comment); + // console.log('🟢 BoardComment.vue의 commentId:', props.comment.commentId); + + // console.log('🔍 emit 하기 전 reactionData:', { + // boardId: props.comment.boardId, + // commentId: props.comment.commentId, + // ...reactionData + // }); + emit('updateReaction', { boardId: props.comment.boardId, - commentId: props.comment.commentId, - ...reactionData + commentId: props.comment.commentId || reactionData.commentId, // 기존 reactionData에 commentId가 없으면 props.comment.commentId 사용 + ...reactionData, }); + + // console.log('🚀 emit 완료!'); }; // 수정 diff --git a/src/components/board/BoardCommentList.vue b/src/components/board/BoardCommentList.vue index 9faea9a..a72b1d8 100644 --- a/src/components/board/BoardCommentList.vue +++ b/src/components/board/BoardCommentList.vue @@ -13,9 +13,8 @@ @deleteClick="deleteClick" @submitPassword="submitPassword" @submitComment="submitComment" - @updateReaction="(reactionData) => handleUpdateReaction(reactionData, comment.commentId)" + @updateReaction="(reactionData) => handleUpdateReaction(reactionData, comment.commentId, comment.boardId)" /> - @@ -46,17 +45,13 @@ const submitComment = (replyData) => { emit('submitComment', replyData); }; -const handleUpdateReaction = (reactionData, commentId) => { - // console.log('📢 BoardCommentList에서 이벤트 수신:', reactionData); - // console.log('📌 전달할 댓글 ID>>>>:', commentId); - +const handleUpdateReaction = (reactionData, commentId, boardId) => { const updatedReactionData = { ...reactionData, - commentId: commentId + commentId: commentId || reactionData.commentId, + boardId: boardId || reactionData.boardId, }; - // console.log('🚀 최종 전달할 데이터:', updatedReactionData); - emit('updateReaction', updatedReactionData); } diff --git a/src/components/board/BoardProfile.vue b/src/components/board/BoardProfile.vue index 390fc9d..6cbb573 100644 --- a/src/components/board/BoardProfile.vue +++ b/src/components/board/BoardProfile.vue @@ -31,9 +31,10 @@ + > + diff --git a/src/components/button/BoardRecommendBtn.vue b/src/components/button/BoardRecommendBtn.vue index f7c98e2..e297eb7 100644 --- a/src/components/button/BoardRecommendBtn.vue +++ b/src/components/button/BoardRecommendBtn.vue @@ -8,7 +8,7 @@