[Vuejs]-Dynamically show and hide button according to computed property in vuejs

1👍

there is no need to write isCommentIdMatched property, instead you can use change some lines.

add v-bind="comments" in below line

<div v-bind="comments" class="comment-list" v-for="comment in comments" :key="comment._id">

and add v-if="comment.userId && comment.userId.match(getUserId)" in below button

<button v-if="comment.userId && comment.userId.match(getUserId)" v-on:click="deleteComment(comment.userId)" class="del-btn">delete</button>

Leave a comment