Within the template of another component, I have two components that can be toggled based on clicks on "reply" and "edit" buttons.
<comment-form :model="model" :model-id="modelId" :comment="comment" v-if="showEditForm && canComment" @closeForm="closeForm"></comment-form>
<comment-form :model="model" :model-id="modelId" :parent-id="comment.id" :reply-to="comment" v-if="showReplyForm && canComment" @closeForm="closeForm"></comment-form>
The current issue is that after clicking "edit" and then "reply," it appears that the "edit" form remains open instead of closing and opening the "reply" form as desired.
These methods control the display of the forms:
methods: {
closeForm: function () {
this.showReplyForm = false;
this.showEditForm = false;
},
reply: function () {
this.showReplyForm = true;
this.showEditForm = false;
},
editComment: function () {
this.showEditForm = true;
this.showReplyForm = false;
},
},
I am looking to understand why this behavior is occurring and how to correct it.
For reference, here is the complete comment.vue
file:
<template>
// The rest of the content has been omitted for brevity.
</script>