From 7e0ae7063dc4dc46d766f4d11ef2af692f631600 Mon Sep 17 00:00:00 2001 From: nevermoregb Date: Thu, 3 Apr 2025 22:17:30 +0900 Subject: [PATCH] =?UTF-8?q?boardview=20=EC=97=90=EC=84=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=20=ED=81=B4=EB=A6=AD=20=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/board/BoardComment.vue | 31 +++++ src/components/board/BoardCommentList.vue | 6 +- src/components/board/BoardProfile.vue | 12 +- src/components/button/DeleteBtn.vue | 17 +-- src/components/button/EditBtn.vue | 14 ++- src/views/board/BoardView.vue | 144 ++++++++++++++++------ 6 files changed, 172 insertions(+), 52 deletions(-) diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index 200704f..940c6bc 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -12,6 +12,8 @@ :isLike="!isLike" :isCommentPassword="isCommentPassword" :isCommentProfile="true" + :is-edit-pushed="isEditPushed" + :is-delete-pushed="isDeletePushed" @editClick="handleEditClick" @deleteClick="$emit('deleteClick', comment)" @updateReaction="handleUpdateReaction" @@ -116,9 +118,20 @@ password: { type: String, }, + // isEditPushed: { + // type: Boolean, + // required: false, + // }, + // isDeletePushed: { + // type: Boolean, + // required: false, + // }, editCommentAlert: String, }); + const isEditPushed = ref(false); + const isDeletePushed = ref(false); + const displayName = computed(() => { return props.nickname ? props.nickname : props.comment.author; }); @@ -171,6 +184,24 @@ emit('submitPassword', props.comment, props.password); }; + const handleInject = inject('isBtnPushed'); + + // 수정, 삭제 버튼 활성화 상태값 + watch( + () => handleInject.value, + (newValue, oldValue) => { + if (newValue) { + if (newValue.target == props.comment.commentId) { + isEditPushed.value = newValue.isEditPushed; + isDeletePushed.value = newValue.isDeletePushed; + } else { + isEditPushed.value = false; + isDeletePushed.value = false; + } + } + }, + ); + watch( () => props.comment.isEditTextarea, newVal => { diff --git a/src/components/board/BoardCommentList.vue b/src/components/board/BoardCommentList.vue index 49ec969..0181b80 100644 --- a/src/components/board/BoardCommentList.vue +++ b/src/components/board/BoardCommentList.vue @@ -13,6 +13,8 @@ :currentPasswordCommentId="currentPasswordCommentId" :password="password" :editCommentAlert="editCommentAlert[comment.commentId]" + :is-edit-pushed="comment.isEditPushed" + :is-delete-pushed="comment.isDeletePushed" @editClick="handleEditClick" @deleteClick="handleDeleteClick" @submitPassword="submitPassword" @@ -40,6 +42,8 @@ :passwordCommentAlert="passwordCommentAlert" :password="password" :editCommentAlert="editCommentAlert[child.commentId]" + :is-edit-pushed="child.isEditPushed" + :is-delete-pushed="child.isDeletePushed" @editClick="handleReplyEditClick" @deleteClick="$emit('deleteClick', child)" @submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent, child.commentId)" @@ -59,7 +63,7 @@ diff --git a/src/components/button/EditBtn.vue b/src/components/button/EditBtn.vue index 5058a97..c340e88 100644 --- a/src/components/button/EditBtn.vue +++ b/src/components/button/EditBtn.vue @@ -1,10 +1,10 @@