[Vuejs]-Vue.js Passing variable from one component to another (jQuery)

1๐Ÿ‘

โœ…

You should not use jQuery and Vue.js at the same time.

You should try to use props to send data from parent to child.

You could add EditComment as an element in your ShowComment something like this:

<EditComment CommentRecID="this.CommentRecID" v-if="showEdit" />

And toggle the showEdit flag from the editItem method

editItem() {
 this.showEdit = true
}

If you want to show a modal, then your EditComment component is probably up the tree so you could either use EventBus or use Vuex.

It seems like you are already using Vuex in your project, so add a mutation that stores the CommentRecID and use it in a similar manner to show the dialog.

-1๐Ÿ‘

You can use Vue Props to easily solve this problem, you have to send the variable from parent component to child component, please check this PROPS documentation out, its self explanatory:

Props Vuejs documentation
please let me know if you find trouble in using props

Leave a comment