[Vuejs]-How to access the child component prop from parent component prop

0👍

You can create a method in your booksmandala-originals-form component that takes the json object as argument and stores it wherever you need. Then you can pass this method as a prop to your child component. And in the child component you can call the method when you receive the json object and pass it to this method as argument.

PASS THE METHOD AS PROP:

<media-upload
   :jsonHandler="jsonHandler"
   >

SCRIPT SECTION IN PARENT

data () {
      return {
            myJsonData: null
      }
},
methods: {
    jsonHandler(jsonData) {
        this.myJsonData = jsonData;
    }
}

In the child you just call this.jsonHandler(<pass your data>).

Leave a comment