Skip to content

Commit 828d227

Browse files
committed
Update readme with data infos.
1 parent 42b88d2 commit 828d227

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ var root = new Vue({
1717
},
1818
'/work/:work': {
1919
componentId: 'fg-work',
20-
afterUpdate: 'updateHeader'
20+
afterUpdate: 'updateHeader',
21+
data: {
22+
defaultColor: '#3453DD'
23+
}
2124
},
2225
options: {
2326
hashbang: true
@@ -62,12 +65,14 @@ Vue.use(route); // BOOM
6265
* routes definition: when you pass your routes to the $root, you can pass several properties:
6366
* *componentId*: the Vue.component id for the associated template/VM.
6467
* *beforeUpdate*: a callback (method or name of method on the vm) to call before effectively changing to this route
65-
* *afterUpdate*: a callback (mehod or name of method on the vm) to call after effectively having changed to this route
68+
* *afterUpdate*: a callback (method or name of method on the vm) to call after effectively having changed to this route
69+
* *data*: an object that will be passed back to the view. This is useful when we need to use the same component for different urls but using different data.
6670
* *isDefault*: boolean indicating wether this page should be the default, in case of non-existing URL. Think of it as the `otherwise` from Angular, so basically a 404 or the home page.
6771

6872
Vue is augmented with an additional method, `Vue.navigate(path, [trigger])`. [trigger] is a boolean (defaults to true) that will `pushState` if true, `replaceState` otherwise.
6973

7074
* The router will emit events on your $root VM: `routing:started`, `routing:beforeUpdate`, `routing:afterUpdate`.
75+
7176
* You can pass a `options` hash to pass configuration to the router:
7277
* `hashbang` boolean (defaults to false) to use '#!' urls
7378
* `click` boolean (defaults to true) to automatically bind all click to the router. Not that if `false`, you will need to explicitly call `Vue.navigate` method)
@@ -76,6 +81,7 @@ Vue is augmented with an additional method, `Vue.navigate(path, [trigger])`. [tr
7681
* `debug` boolean (defaults to false) to activate logging from the directive.
7782

7883
## Location context
84+
7985
When the router emits an event, 2 parameters are passed: `location` and `oldLocation`. Like in Angular, it is an object containing some useful properties:
8086
* regexp: the route regexp, such as `/items/:itemId`
8187
* path: the current path, such as `/items/razor/`

0 commit comments

Comments
 (0)