All Projects → vuejs → Vuex Router Sync

vuejs / Vuex Router Sync

Licence: mit
Effortlessly keep vue-router and vuex store in sync.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Vuex Router Sync

Vue Mall Mobile
🔥 vue + koa + mongodb 搭建 mobile web 商城 (End。。。)
Stars: ✭ 201 (-91.96%)
Mutual labels:  vuex, vue-router
Vue Blog
🎉 基于vue全家桶 + element-ui 构建的一个后台管理集成解决方案
Stars: ✭ 208 (-91.68%)
Mutual labels:  vuex, vue-router
Mmf Blog Vue2 Ssr
mmf-blog-vue2 ssr(The service side rendering)
Stars: ✭ 174 (-93.04%)
Mutual labels:  vuex, vue-router
Douban
Awesome douban DEMO created with Vue2.x + Vuex + Vue-router + Superagent
Stars: ✭ 2,324 (-7%)
Mutual labels:  vuex, vue-router
Yoyocms.abpprojecttemplate
一个基于-vue+vuex+vue-router+EF开发的权限管理系统
Stars: ✭ 213 (-91.48%)
Mutual labels:  vuex, vue-router
Vue2 Demo
Vue 基于 Genesis + TS + Vuex 实现的 SSR demo
Stars: ✭ 2,072 (-17.09%)
Mutual labels:  vuex, vue-router
Vue Cheatsheet
Modified version of the official VueMastery cheatsheet
Stars: ✭ 188 (-92.48%)
Mutual labels:  vuex, vue-router
Symfony Vuejs
Source code of the tutorial "Building a single-page application with Symfony 4 and Vue.js"
Stars: ✭ 170 (-93.2%)
Mutual labels:  vuex, vue-router
Vue Electron
vue-blog client,base on vue-electron,axios, vuex, vue-router.
Stars: ✭ 193 (-92.28%)
Mutual labels:  vuex, vue-router
Vue Cnode
🚀 基于vue3 function-based 构建cnode社区
Stars: ✭ 192 (-92.32%)
Mutual labels:  vuex, vue-router
Vue Admin Template
a vue2.0 minimal admin template
Stars: ✭ 15,411 (+516.69%)
Mutual labels:  vuex, vue-router
Venture Management
一个包含vuejs和nodejs技术的全栈项目
Stars: ✭ 208 (-91.68%)
Mutual labels:  vuex, vue-router
Eth Vue
Featured in Awesome Vue [https://github.com/vuejs/awesome-vue], a curated list maintained by vuejs of awesome things related to the Vue.js framework, and Awesome List [https://awesomelists.net/150-Vue.js/3863-Open+Source/18749-DOkwufulueze-eth-vue], this Truffle Box provides everything you need to quickly build Ethereum dApps that have authentication features with vue, including configuration for easy deployment to the Ropsten Network. It's also Gravatar-enabled. Connecting to a running Ganache blockchain network from Truffle is also possible -- for fast development and testing purposes. Built on Truffle 5 and Vue 3, eth-vue uses vuex for state management, vuex-persist for local storage of app state, and vue-router for routing. Authentication functionalities are handled by Smart Contracts running on the Ethereum blockchain.
Stars: ✭ 171 (-93.16%)
Mutual labels:  vuex, vue-router
Vuesion
Vuesion is a boilerplate that helps product teams build faster than ever with fewer headaches and modern best practices across engineering & design.
Stars: ✭ 2,510 (+0.44%)
Mutual labels:  vuex, vue-router
Lin Cms Vue
🔆 Vue+ElementPlus构建的CMS开发框架
Stars: ✭ 2,341 (-6.32%)
Mutual labels:  vuex, vue-router
Vue Cnode
一个vuex vue-router vue-resource的单页面应用demo,api来自cnodejs. vue 1
Stars: ✭ 174 (-93.04%)
Mutual labels:  vuex, vue-router
Roastapp
Laravel学院 Roast 应用源码
Stars: ✭ 164 (-93.44%)
Mutual labels:  vuex, vue-router
Vue Objccn
🔥 Use Vue.js to develop a cross-platform full stack application / 用 Vue.js 开发的跨三端应用
Stars: ✭ 1,993 (-20.25%)
Mutual labels:  vuex, vue-router
Vuesocial
something like QQ、weibo、weChat(vue+express+socket.io仿微博、微信的聊天社交平台)
Stars: ✭ 189 (-92.44%)
Mutual labels:  vuex, vue-router
Lvyou
🎒Vue.js 初步进阶案例,路由懒加载,进入页面前登录判断,返回导航判断,RestAPI接口使用,组件封装,Vuex状态封装,keep-alive页面缓存等功能
Stars: ✭ 195 (-92.2%)
Mutual labels:  vuex, vue-router

Vuex Router Sync

npm ci status coverage license

Sync Vue Router's current $route as part of Vuex store's state.

中文版本 (Chinese Version)

Usage

# the latest version works only with vue-router >= 2.0
npm install vuex-router-sync

# for usage with vue-router < 2.0:
npm install vuex-router-sync@2
import { sync } from 'vuex-router-sync'
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)
unsync() // Unsyncs store from router

You can optionally set a custom vuex module name:

sync(store, router, { moduleName: 'RouteModule' } )

How does it work?

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

    store.state.route.path   // current path (string)
    store.state.route.params // current params (object)
    store.state.route.query  // current query (object)
  • When the router navigates to a new route, the store's state is updated.

  • 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

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].