Skip to content

Commit 2f7dba5

Browse files
committed
chore: update README
1 parent b11b6ce commit 2f7dba5

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,35 @@
55
[![coverage](https://codecov.io/gh/vuejs/vuex-router-sync/branch/6.x/graph/badge.svg?token=4KJug3I5do)](https://codecov.io/gh/vuejs/vuex-router-sync)
66
[![license](https://img.shields.io/npm/l/vuex-router-sync.svg?sanitize=true)](http://opensource.org/licenses/MIT)
77

8+
---
9+
10+
:fire: **HEADS UP!** You're currently looking at Vuex Router Synx 6 branch which supports Vue 3. If you're looking for Vuex Router Sync 5 for Vue 2 support, [please check out `dev` branch](https://github.com/vuejs/vuex-router-sync).
11+
12+
---
13+
814
Sync Vue Router's current `$route` as part of Vuex store's state.
915

1016
[中文版本 (Chinese Version)](README.zh-cn.md)
1117

1218
## Usage
1319

1420
``` bash
15-
# the latest version works only with vue-router >= 2.0
16-
npm install vuex-router-sync
17-
18-
# for usage with vue-router < 2.0:
19-
npm install vuex-router-sync@2
21+
npm install vuex-router-sync@next
2022
```
2123

2224
``` js
2325
import { sync } from 'vuex-router-sync'
2426
import store from './store' // vuex store instance
2527
import router from './router' // vue-router instance
2628

27-
const unsync = sync(store, router) // done. Returns an unsync callback fn
29+
const unsync = sync(store, router) // done. returns an unsync callback fn
2830

2931
// bootstrap your app...
3032

31-
// During app/Vue teardown (e.g., you only use Vue.js in a portion of your app
33+
// during app/Vue teardown (e.g., you only use Vue.js in a portion of your app
3234
// and you navigate away from that portion and want to release/destroy
3335
// Vue components/resources)
34-
unsync() // Unsyncs store from router
36+
unsync() // unsyncs store from router
3537
```
3638

3739
You can optionally set a custom vuex module name:
@@ -48,6 +50,7 @@ sync(store, router, { moduleName: 'RouteModule' } )
4850
store.state.route.path // current path (string)
4951
store.state.route.params // current params (object)
5052
store.state.route.query // current query (object)
53+
...
5154
```
5255

5356
- When the router navigates to a new route, the store's state is updated.

0 commit comments

Comments
 (0)