From d954a1b68c7399c19a4ea4ec674bf5caca5491ca Mon Sep 17 00:00:00 2001 From: kimdaae328 Date: Fri, 28 Feb 2025 00:58:38 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardComment.vue | 9 ++++++++- src/components/board/BoardCommentList.vue | 6 +++++- src/views/board/BoardView.vue | 9 ++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index c264de7..965f6d7 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -59,12 +59,13 @@ :isCommentProfile="true" :isCommentAuthor="child.isCommentAuthor" :isCommentPassword="isCommentPassword" - @editClick="$emit('editClick', $event)" + @editClick="handleReplyEditClick " @deleteClick="$emit('deleteClick', child)" @submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)" @cancelEdit="$emit('cancelEdit', child)" @submitComment="submitComment" @updateReaction="handleUpdateReaction" + @submitPassword="logPasswordAndEmit" /> @@ -143,6 +144,7 @@ const handleUpdateReaction = (reactionData) => { // 비밀번호 확인 const logPasswordAndEmit = () => { + console.log('비밀번호 확인',password.value) emit('submitPassword', props.comment, password.value); password.value = ""; }; @@ -162,4 +164,9 @@ const handleEditClick = () => { emit('editClick', props.comment); } +const handleReplyEditClick = (event) => { + console.log("📌 editClick 이벤트 실행됨! 전달된 데이터:", event); + emit('editClick', event); +} + diff --git a/src/components/board/BoardCommentList.vue b/src/components/board/BoardCommentList.vue index 3ee4624..3c315a8 100644 --- a/src/components/board/BoardCommentList.vue +++ b/src/components/board/BoardCommentList.vue @@ -78,7 +78,11 @@ const submitPassword = (comment, password) => { }; const handleEditClick = (comment) => { - emit('editClick', comment); + if (comment.parentId) { + emit('deleteClick', comment); // 대댓글 + } else { + emit('deleteClick', comment); // 댓글 + } }; const handleSubmitEdit = (comment, editedContent) => { diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index 5a6caf8..725dd2a 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -482,7 +482,6 @@ const findCommentById = (commentId, commentsList) => { // 댓글 수정 버튼 클릭 const editComment = (comment) => { - // 부모 또는 대댓글을 찾아서 가져오기 const targetComment = findCommentById(comment.commentId, comments.value); @@ -590,9 +589,10 @@ const submitPassword = async () => { // 댓글 삭제 (비밀번호 확인 후) const submitCommentPassword = async (comment, password) => { + console.log('야야야') - // console.log("비밀번호 :", password); - // console.log("댓글 ID:", comment.commentId); + console.log("비밀번호 :", password); + console.log("댓글 ID:", comment.commentId); if (!password) { passwordCommentAlert.value = "비밀번호를 입력해주세요."; @@ -607,7 +607,7 @@ const submitCommentPassword = async (comment, password) => { LOCCMTPWD: password, LOCCMTSEQ: comment.commentId, }); - // console.log("✅ 서버 응답 데이터:", response.data); + console.log("✅ 서버 응답 데이터:", response.data); if (response.data.code === 200 && response.data.data === true) { passwordCommentAlert.value = ""; @@ -671,7 +671,6 @@ const deletePost = async () => { // 댓글 삭제 (대댓글 포함) const deleteReplyComment = async (comment) => { if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return; - console.log("댓글 수정, 대댓글도?"); try { const response = await axios.delete(`board/comment/${comment.commentId}`, {