biluochun / Vuex Localstate
Licence: mit
vuex plugin
Stars: ✭ 18
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Vuex Localstate
Cordova Template Framework7 Vue Webpack
Framework7 - Vue - Webpack Cordova Template with Webpack Dev Server and Hot Module Replacement
Stars: ✭ 630 (+3400%)
Mutual labels: vuex
Vuecnodejs
⚽️🎉Vue初/中级项目,CnodeJS社区重构。( a junior project of Vue.js, rewrite cnodejs.org ) 预览(DEMO):
Stars: ✭ 705 (+3816.67%)
Mutual labels: vuex
Vue Music Player
🎵Vue.js写一个音乐播放器+📖One(一个).A music player + One by Vue.js
Stars: ✭ 729 (+3950%)
Mutual labels: vuex
Vuex I18n
Localization plugin for vue.js 2.0 using vuex as store
Stars: ✭ 657 (+3550%)
Mutual labels: vuex
Vue 163 Music
【停止维护】网易云音乐web版,支持PC端常用功能,localStorage保存播放列表
Stars: ✭ 788 (+4277.78%)
Mutual labels: vuex
Kov Blog
A blog platform built with koa,vue and mongoose. 使用 koa ,vue 和 mongo 搭建的博客页面和支持markdown语法的博客编写平台,自动保存草稿。博客地址:https://chuckliu.me
Stars: ✭ 635 (+3427.78%)
Mutual labels: vuex
Vuejs Training
VueJS training including Vue ecosystem: HTTP (Axios), Vuex, Unit Testting (Jest)...
Stars: ✭ 6 (-66.67%)
Mutual labels: vuex
vuex-local-state
inject localStorage to vuex
Installation
$ npm install vuex-local-state --save
API
new VuexLocalState(storeOptions, [conf]);
conf default: {
namespace: '_vued',
storage: window.localStorage,
key: 'localState',
}
Examples
Usage
import * as Vue from 'vue';
import * as Vuex from 'vuex';
import * as VuexLocalState from 'vuex-local-state';
import subModule from './subModule.js';
const storeOptions = {
// https://vuex.vuejs.org/zh-cn/state.html
state: {},
// vuex-local-state inject
// 1、 data in vuex and localStorage,
// 2、 can be a Function: function (count) { return (count || 0) + 1; }
// 3、 use: store.state.xxx
// 4、 [Not] use: store.localState.xxx
localState: {
count: oldValue => (oldValue || 0) + 1,
},
actions: {},
getters: {},
mutations: {},
modules: { subModule },
};
new VuexLocalState(storeOptions);
Vue.use(Vuex);
export new Vuex.Store(storeOptions);
// subModule.js
// vuex module
export default {
// https://vuex.vuejs.org/zh-cn/state.html
state: {},
// vuex-local-state inject
// 1、 data in vuex and localStorage,
// 2、 can be a Function: function (count) { return (count || 0) + 1; }
// 3、 use: store.state.xxx
// 4、 [Not] use: store.localState.xxx
localState: {
aaaaa: 1,
bbbbb: null,
ccccc: oldValue => (oldValue || 0) + 1,
ddddd: (oldValue = {}) => {
if (Date.now() - (oldValue.saveTime || 0) < 60 * 1000) return oldValue;
return {};
},
},
getters: {},
actions: {},
mutations: {},
};
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].