Skip to content

Commit

Permalink
chore: update some stylings to match other latest vue libs
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Apr 23, 2020
1 parent d57ed0b commit dad8c8b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Evan You
Copyright (c) 2016-present Evan You

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 7 additions & 6 deletions README.md
Expand Up @@ -2,7 +2,7 @@

> Sync vue-router's current $route as part of vuex store's state.
### Usage
## Usage

``` bash
# the latest version works only with vue-router >= 2.0
Expand All @@ -14,15 +14,16 @@ npm install vuex-router-sync@2

``` js
import { sync } from 'vuex-router-sync'
import store from './vuex/store' // vuex store instance
import store from './store' // vuex store instance
import router from './router' // vue-router instance

const unsync = sync(store, router) // done. Returns an unsync callback fn

// bootstrap your app...

// During app/Vue teardown (e.g., you only use Vue.js in a portion of your app and you
// navigate away from that portion and want to release/destroy Vue components/resources)
// During app/Vue teardown (e.g., you only use Vue.js in a portion of your app
// and you navigate away from that portion and want to release/destroy
// Vue components/resources)
unsync() // Unsyncs store from router
```

Expand All @@ -32,7 +33,7 @@ You can optionally set a custom vuex module name:
sync(store, router, { moduleName: 'RouteModule' } )
```

### How does it work?
## How does it work?

- It adds a `route` module into the store, which contains the state representing the current route:

Expand All @@ -46,6 +47,6 @@ sync(store, router, { moduleName: 'RouteModule' } )

- **`store.state.route` is immutable, because it is derived state from the URL, which is the source of truth**. You should not attempt to trigger navigations by mutating the route object. Instead, just call `$router.push()` or `$router.go()`. Note that you can do `$router.push({ query: {...}})` to update the query string on the current path.

### License
## License

[MIT](http://opensource.org/licenses/MIT)
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -3,11 +3,11 @@
"version": "5.0.0",
"description": "Effortlessly keep vue-router and vuex store in sync.",
"main": "index.js",
"typings": "types/index.d.ts",
"files": [
"index.js",
"types/*.d.ts"
],
"typings": "types/index.d.ts",
"scripts": {
"test": "jest && npm run test:types",
"test:types": "tsc -p types/test",
Expand All @@ -30,16 +30,16 @@
"url": "https://github.com/vuejs/vuex-router-sync/issues"
},
"homepage": "https://github.com/vuejs/vuex-router-sync#readme",
"peerDependencies": {
"vue-router": "^3.0.0",
"vuex": "^3.0.0"
},
"devDependencies": {
"buble": "^0.16.0",
"jest": "^21.2.1",
"typescript": "^2.5.3",
"vue": "^2.5.0",
"vue-router": "^3.0.0",
"vuex": "^3.0.0"
},
"peerDependencies": {
"vue-router": "^3.0.0",
"vuex": "^3.0.0"
}
}

0 comments on commit dad8c8b

Please sign in to comment.