[Vuejs]-How to make child components aware of nested init data in Vue?

0👍

Solved: I have to pass quite anything..

Vue.component('area-selectors-box', {
  template: `
    <div class="selectors-box">
      <area-selector v-for="select in selects" :select="select"></area-selector>
    </div>
  `,
  props:['selects']
});

Vue.component('area-selector', {
  template: `
    <select :select="select">
      <option disabled selected value="">Seleziona continente</option>
      <area-option v-for="area in select.areas" :area="area" :key="area.term_id"></area-option>
    </select>
  `,
  props:['select']
});

Vue.component('area-option', {
  template: `<option :area="area">{{area.name}}<slot></slot></option>`
  ,props: ['area']
});

Leave a comment