November 2017
Beginner to intermediate
398 pages
8h 42m
English
When processing a request, we need to fetch the data on the relevant components before rendering the app. That way, the data will already be displayed when the HTML is loaded by the browser. For example, PageHome.vue fetches the store items and PageStoreItem.vue retrieves the item details and comments.
We will add a new asyncData custom option to those, so we can call it on the server when doing SSR.
asyncData ({ store }) { return store.dispatch('items/fetchItems') },
Read now
Unlock full access