Skip to content

egoist/vue-router-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-router-sync

NPM version NPM downloads CircleCI

Keep vm data and router state in sync.

Install

yarn add vue-router-sync

CDN: UNPKG | jsDelivr (available as window.RouterSync)

Usage

Note that this is supposed to work with vue-router:

import Vue from 'vue'
import RouterSync from 'vue-router-sync'

Vue.use(RouterSync)

Then in your component

<script>
export default {
  data() {
    return {
      foo: 'foo'
    }
  },
  syncDataRouter: {
    foo: 'foo_in_query'
  }
}
</script>

Mount the app and the URL will be updated to /?foo_in_query=foo. Everytime the foo is changed the corresponding URL query will be updated too.

License

MIT © EGOIST

About

Keep vm data and router state in sync.

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published