From 63f8f167ebc631d57eed7456b905f5f31ed8703f Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Fri, 28 Feb 2025 10:57:25 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=BD=EA=B3=A0=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardComment.vue | 8 ++++---- src/components/board/BoardCommentArea.vue | 4 ++-- src/components/board/BoardCommentList.vue | 11 +++++------ src/components/board/BoardProfile.vue | 2 +- src/components/button/BoardRecommendBtn.vue | 4 ++-- src/views/board/BoardView.vue | 3 ++- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index 82b54ea..4ad12f7 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -59,7 +59,7 @@ :isCommentProfile="true" :isCommentAuthor="child.isCommentAuthor" :isCommentPassword="isCommentPassword" - @editClick="handleReplyEditClick " + @editClick="handleReplyEditClick" @deleteClick="$emit('deleteClick', child)" @submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)" @cancelEdit="$emit('cancelEdit', child)" @@ -110,7 +110,7 @@ const props = defineProps({ }, passwordCommentAlert: { type: String, - default: false + default: '' } }); @@ -164,8 +164,8 @@ const handleEditClick = () => { emit('editClick', props.comment); } -const handleReplyEditClick = (event) => { - emit('editClick', event); +const handleReplyEditClick = (comment) => { + emit('editClick', comment); } diff --git a/src/components/board/BoardCommentArea.vue b/src/components/board/BoardCommentArea.vue index c7cfe2c..ed153ab 100644 --- a/src/components/board/BoardCommentArea.vue +++ b/src/components/board/BoardCommentArea.vue @@ -73,11 +73,11 @@ const props = defineProps({ }, passwordAlert: { type: String, - default: false + default: '' }, commentAlert: { type: String, - default: false + default: '' } }); diff --git a/src/components/board/BoardCommentList.vue b/src/components/board/BoardCommentList.vue index 3c315a8..8ac413b 100644 --- a/src/components/board/BoardCommentList.vue +++ b/src/components/board/BoardCommentList.vue @@ -11,12 +11,11 @@ :isCommentAuthor="comment.isCommentAuthor" :isEditTextarea="comment.isEditTextarea" :isCommentPassword="isCommentPassword" - :passwordCommentAlert="passwordCommentAlert" + :passwordCommentAlert="passwordCommentAlert || ''" @editClick="handleEditClick" @deleteClick="handleDeleteClick" @submitPassword="submitPassword" @submitComment="submitComment" - @commentDeleted="handleCommentDeleted" @submitEdit="handleSubmitEdit" @cancelEdit="handleCancelEdit" @updateReaction="(reactionData) => handleUpdateReaction(reactionData, comment.commentId, comment.boardId)" @@ -53,11 +52,11 @@ const props = defineProps({ }, passwordCommentAlert: { type: String, - default: false + default: '' } }); -const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword']); +const emit = defineEmits(['submitComment', 'updateReaction', 'editClick', 'deleteClick', 'submitPassword', 'clearPassword','submitEdit']); const submitComment = (replyData) => { emit('submitComment', replyData); @@ -79,9 +78,9 @@ const submitPassword = (comment, password) => { const handleEditClick = (comment) => { if (comment.parentId) { - emit('deleteClick', comment); // 대댓글 + emit('editClick', comment); // 대댓글 } else { - emit('deleteClick', comment); // 댓글 + emit('editClick', comment); // 댓글 } }; diff --git a/src/components/board/BoardProfile.vue b/src/components/board/BoardProfile.vue index cf43b87..e357e1d 100644 --- a/src/components/board/BoardProfile.vue +++ b/src/components/board/BoardProfile.vue @@ -82,7 +82,7 @@ const props = defineProps({ isCommentProfile: Boolean, // 현재 컴포넌트가 댓글용인지 여부 date: { type: String, - required: true, + required: '', }, views: { type: Number, diff --git a/src/components/button/BoardRecommendBtn.vue b/src/components/button/BoardRecommendBtn.vue index e297eb7..8ffa805 100644 --- a/src/components/button/BoardRecommendBtn.vue +++ b/src/components/button/BoardRecommendBtn.vue @@ -13,7 +13,7 @@ import { ref, computed } from 'vue'; const props = defineProps({ comment: { type: Object, - required: true, + default: () => ({}), }, likeClicked : { type : Boolean, @@ -36,7 +36,7 @@ const props = defineProps({ required: true, }, commentId: { - type: Number, + type: [Number, null], default: null, }, likeCount: { diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index cfacd8f..358c192 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -175,6 +175,7 @@ const passwordAlert = ref(""); const passwordCommentAlert = ref(""); const isPassword = ref(false); const isCommentPassword = ref(false); +const currentPasswordCommentId = ref(null); const lastClickedButton = ref(""); const lastCommentClickedButton = ref(""); const isEditTextarea = ref(false); @@ -487,6 +488,7 @@ const deleteComment = async (comment) => { // 익명 비밀번호 창 토글 const toggleCommentPassword = (comment, button) => { + console.log(comment.commentId) if (lastCommentClickedButton.value === button && isCommentPassword.value === comment.commentId) { isCommentPassword.value = false; // 비밀번호 창 닫기 } else { @@ -637,7 +639,6 @@ const deleteReplyComment = async (comment) => { // 댓글 수정 확인 const handleSubmitEdit = async (comment, editedContent) => { - console.log('asdasdasdasd') try { const response = await axios.put(`board/comment/${comment.commentId}`, { LOCCMTSEQ: comment.commentId,