[Vuejs]-Vue not loading data into child component

2👍

There is race condition.

Either not render a child until data is available; serverMap needs to be null instead of empty object in order to be distinguished from populated object:

<image-gallery v-if="serverMap" :serverData="serverMap"/>

Or delay data access in a child until it’s available instead of doing this immediately in created:

watch: {
  serverData(data) {
    if (data)
      this.loadImages()
  }
}

Leave a comment