[Vuejs]-Vue Component interact with page where its in

1๐Ÿ‘

โœ…

If I understood your questions correctly, you want to communicate (pass data) from Child components to parent component (page).

The way we can achieve this is by $emitting events from Child components and have the parent component respond to these events.

So, in your editComment and openReply methods you would fire events like this:

        openReply(row) {
            this.$emit('openReply', {any payload that you would want pass to parent});
        },

        editComment(item) {
            this.$emit('editComment', {any payload that you would want pass to parent}
        },

And, in your parent component / page you would subscribe and handle those events. Pseudo-code below:

<Comment v-on:openReply="handleOpenReply"
         v-on:editCommnet="handleEditComment"/>

Further Reading:

Passing Data to Child Components With Props

Listening to Child Components Events

๐Ÿ‘คSuresh

Leave a comment