[Vuejs]-How to pass data to child component from parent vuejs

1👍

You need to create a property in your component and pass the page to it from the parent.

e.g. parent template

<theme-parallax v-for="page in pageData" :page="page" :key="page.id"></theme-parallax>

If the page doesn’t have a unique id, you should use a unique property for the key.

Then in the component

Vue.component('theme-parallax',{
  template: '#parallax-tpl',
  props: {
    page: {
      type: Object,
      default: function() {return null;},
    }
  },
  data(){
    return{
      pageData: []
    }
  }
});

Leave a comment