You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,10 @@ var root = new Vue({
17
17
},
18
18
'/work/:work': {
19
19
componentId: 'fg-work',
20
-
afterUpdate: 'updateHeader'
20
+
afterUpdate: 'updateHeader',
21
+
data: {
22
+
defaultColor: '#3453DD'
23
+
}
21
24
},
22
25
options: {
23
26
hashbang: true
@@ -62,12 +65,14 @@ Vue.use(route); // BOOM
62
65
* routes definition: when you pass your routes to the $root, you can pass several properties:
63
66
**componentId*: the Vue.component id for the associated template/VM.
64
67
**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.
66
70
**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.
67
71
68
72
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.
69
73
70
74
* The router will emit events on your $root VM: `routing:started`, `routing:beforeUpdate`, `routing:afterUpdate`.
75
+
71
76
* You can pass a `options` hash to pass configuration to the router:
72
77
*`hashbang` boolean (defaults to false) to use '#!' urls
73
78
*`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
76
81
*`debug` boolean (defaults to false) to activate logging from the directive.
77
82
78
83
## Location context
84
+
79
85
When the router emits an event, 2 parameters are passed: `location` and `oldLocation`. Like in Angular, it is an object containing some useful properties:
80
86
* regexp: the route regexp, such as `/items/:itemId`
0 commit comments