Skip to content

Commit f319042

Browse files
committedApr 29, 2017
Update docs to reflect latest changes
1 parent c75f114 commit f319042

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed
 

‎docs/Project-Overview.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
* Node
2121
* [Express](https://expressjs.com/)
22-
* Configured to work with [Vue Server Side Rendering](https://vuejs.org/v2/guide/ssr.html)
22+
* Configured to work with [Vue Server Side Rendering](https://ssr.vuejs.org/en/)
2323

2424
**Build process**
2525

@@ -47,6 +47,7 @@ For detailed explaination check out the [Build Process](Build-Process.md) docume
4747
* `router/`, Vue-router specific files
4848
* `store/`, Vuex specific files
4949
* `styles/`, global style declarations
50+
* `utils/`, utility functions and Vue mixins
5051
* `views/`, Vue components that define the layout of the app
5152
* `App.vue`, the main/entry-point component
5253
* `app.js`, the script that initializes the whole App

‎docs/Server-Side-Rendering.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# Server Side Rendering
22

3-
It is possible for components to define a `preFetch` hook that will be called server side when rendering the component. This hook should return a promise that will resolve once the component is ready to be rendered.
3+
It is possible for components to define a `asyncData` hook that will be called server side when rendering the component. This hook should return a promise that will resolve once the component is ready to be rendered.
44

55
The interesting part in `entry-server.js`:
66

77
```javascript
8-
// Call preFetch hooks on components matched by the route.
8+
// Call fetchData hooks on components matched by the route.
99
// A preFetch hook dispatches a store action and returns a Promise,
10-
// which is resolved when the action is complete and store state has been updated
10+
// which is resolved when the action is complete and store state has been
11+
// updated.
1112
Promise.all(matchedComponents.map((component) => {
12-
return component.preFetch && component.preFetch(store)
13-
})).then(.....);
13+
return component.asyncData && component.asyncData({
14+
store,
15+
route: router.currentRoute
16+
})
17+
})).then(....)
1418
```
1519

16-
The `preFetch` hook will get access to the vuex `store` object to allow the dispatching of vuex action.
17-
18-
**Hint**: the `preFetch` hook won't be called client side, this means that you will also need to define the proper fetching actions in the `beforeMount` hook. Usually you should `preFetch` core data and `beforeMount`-fetch all of the data.
20+
The `asyncData` hook will get access to the vuex `store` object to allow the dispatching of vuex action.
1921

2022
## Use cases
2123

2224
* Fetching stateless data (page content)
25+
26+
## More
27+
28+
* Check out [the official documentation for SSR](https://ssr.vuejs.org/en/)

0 commit comments

Comments
 (0)
Please sign in to comment.