Skip to content

Commit 6f63fe1

Browse files
committed
Merge branch 'dev'
2 parents 9024872 + 5147341 commit 6f63fe1

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ vue-route
44
Routing directive for Vue.js **(v0.11)**, inspired by ng-view.
55
Based on `v-component` thus benefits from `v-transition`, `keep-alive`, `wait-for`, `transition-mode`.
66

7-
Allows you to declare your routes on the $root Vue object:
7+
Allows you to declare your routes on the `$root` Vue object:
88

9-
```
9+
```js
1010
var root = new Vue({
1111
el: 'body',
1212

@@ -25,14 +25,14 @@ var root = new Vue({
2525
options: {
2626
hashbang: true
2727
}
28-
},
29-
})
28+
}
29+
});
3030

3131
```
3232

33-
with minimal markup:
33+
With minimal markup:
3434

35-
```
35+
```html
3636
<body>
3737
<div v-route></div>
3838
</body>
@@ -45,9 +45,9 @@ with minimal markup:
4545

4646
**1.** Install with npm/component(1): `npm i vue-route --save` or `component install ayamflow/vue-route`.
4747

48-
**2.** require and install the plugin:
48+
**2.** Require and install the plugin:
4949

50-
```
50+
```js
5151
var Vue = require('vue'),
5252
route = require('vue-route');
5353

@@ -56,27 +56,27 @@ Vue.use(route); // BOOM
5656

5757
**3.** Put the `<div v-route></div>` in your main template.
5858

59-
**4.** Pass your routes to the $root VM of you app (see example above).
59+
**4.** Pass your routes to the `$root` VM of you app (see example above).
6060

6161
**5.** Profit !
6262

6363
## Additional infos
6464

65-
* routes definition: when you pass your routes to the $root, you can pass several properties:
66-
* *componentId*: the Vue.component id for the associated template/VM.
67-
* *beforeUpdate*: a callback (method or name of method on the vm) to call before effectively changing 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 **merged** with the view's `$data`. This is useful when we need to use the same component for different urls but using different data.
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.
65+
* Routes definition: when you pass your routes to the `$root`, you can pass several properties:
66+
* `componentId`: the Vue.component id for the associated template/VM.
67+
* `beforeUpdate`: a callback (method or name of method on the vm) to call before effectively changing to this routehtml.
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 **merged** with the view's `$data`. This is useful when we need to use the same component for different urls but using different data.
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.
7171

72-
beforeUpdate is a middleware, this means you need to call the `next` function provided as the third argument, to continue routing. This allows to prevent a route based on some condition.
72+
`beforeUpdate` is a middleware, this means you need to call the `next` function provided as the third argument, to continue routing. This allows to prevent a route based on some condition.
7373

7474
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.
7575

76-
* The router will emit events on your $root VM: `router:started`, `router:beforeUpdate`, `router:afterUpdate`.
76+
* The router will emit events on your `$root` VM: `router:started`, `router:beforeUpdate`, `router:afterUpdate`.
7777

7878
* You can pass a `options` hash to pass configuration to the router:
79-
* `hashbang` boolean (defaults to false) to use '#!' urls
79+
* `hashbang` boolean (defaults to false) to use `#!` urls. Note that your links shouldn't include hashbangs, the router handles this.
8080
* `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)
8181
* `base` string (defaults to '/') to specify the base path
8282
* `broadcast` boolean (defaults to false) if true the events will be emitted using the $root `$broadcast` method, so all child VMs will receive the event until a handler `return false;`. If false, it uses `$emit`.
@@ -85,13 +85,13 @@ Vue is augmented with an additional method, `Vue.navigate(path, [trigger])`. [tr
8585
## Location context
8686

8787
When the router emits an event, 2 parameters are passed: `location` and `oldLocation`. Like in Angular, it is an object containing some useful properties:
88-
* regexp: the route regexp, such as `/items/:itemId`
89-
* path: the current path, such as `/items/razor/`
90-
* params: a hash of the params from the route, here `{item: 'razor'}`
91-
* componentId: the componentId associated to the current route
88+
* `regexp`: the route regexp, such as `/items/:itemId`.
89+
* `path`: the current path, such as `/items/razor/`.
90+
* `params`: a hash of the params from the route, here `{item: 'razor'}`.
91+
* `componentId`: the componentId associated to the current route.
9292

9393
## Contributing
9494

95-
* fork & PR on **[dev](https://github.com/ayamflow/vue-route/tree/dev)** branch.
96-
* if possible, add tests to cover the changes.
97-
* code style: 4 tabs, semicolons. Check the code if in doubt.
95+
* Fork & PR on **[dev](https://github.com/ayamflow/vue-route/tree/dev)** branch.
96+
* If possible, add tests to cover the changes.
97+
* Code style: 4 tabs, semicolons. Check the code if in doubt.

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-route",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"repository": "ayamflow/vue-route",
55
"description": "Routing directive for Vue.js, inspired by ng-view.",
66
"main": "src/index.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-route",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "Routing directive for Vue.js, inspired by ng-view.",
55
"main": "src/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)