All Projects → biluochun → Vuex Localstate

biluochun / Vuex Localstate

Licence: mit
vuex plugin

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
Vue Ts Daily
基于vue、Typescript、pwa的一款习惯养成app
Stars: ✭ 735 (+3983.33%)
Mutual labels:  vuex
Vue Chat
👥Vue全家桶+Socket.io+Express/Koa2打造一个智能聊天室。
Stars: ✭ 887 (+4827.78%)
Mutual labels:  vuex
Vue Example Login
🔥A login demo by Vue.js.
Stars: ✭ 651 (+3516.67%)
Mutual labels:  vuex
Vuecnodejs
⚽️🎉Vue初/中级项目,CnodeJS社区重构。( a junior project of Vue.js, rewrite cnodejs.org ) 预览(DEMO):
Stars: ✭ 705 (+3816.67%)
Mutual labels:  vuex
Hackernews
HackerNews clone built with Nuxt.js
Stars: ✭ 758 (+4111.11%)
Mutual labels:  vuex
New Bee
开源社区 vue + springBoot - 前后分离微服务的最佳实践
Stars: ✭ 619 (+3338.89%)
Mutual labels:  vuex
Easy Vue
Learn vueJS Easily 👻
Stars: ✭ 896 (+4877.78%)
Mutual labels:  vuex
Vue Music Player
🎵Vue.js写一个音乐播放器+📖One(一个).A music player + One by Vue.js
Stars: ✭ 729 (+3950%)
Mutual labels:  vuex
Vue2 Study
vue 的webpack配置,按需加载,element-ui,vuex
Stars: ✭ 16 (-11.11%)
Mutual labels:  vuex
Vuex I18n
Localization plugin for vue.js 2.0 using vuex as store
Stars: ✭ 657 (+3550%)
Mutual labels:  vuex
Vuex
🗃️ Centralized State Management for Vue.js.
Stars: ✭ 27,115 (+150538.89%)
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
Vue Meteor
🌠 Vue first-class integration in Meteor
Stars: ✭ 893 (+4861.11%)
Mutual labels:  vuex
Vue Crud
Vue.js based REST-ful CRUD system
Stars: ✭ 629 (+3394.44%)
Mutual labels:  vuex
H5maker
h5编辑器类似maka、易企秀 账号/密码:admin
Stars: ✭ 753 (+4083.33%)
Mutual labels:  vuex
Jdf Phone Ui
🖖 前端混合开发整合框架(cordova插件,微信,H5)
Stars: ✭ 18 (+0%)
Mutual labels:  vuex
Vuejs Snippets
Collection of Vuejs 2.0+ snippets
Stars: ✭ 17 (-5.56%)
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].