更新记录
1.0.1(2022-12-04) 下载此版本
将本地存储完全替换 state 修改为 合并本地存取和 state 融合到 vuex 中
1.0.0(2022-11-23) 下载此版本
uniapp vue2 vuex 持久化
平台兼容性
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | 12 | - | - |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
快速上手
安装
npm i vuex-uniapp-persistence
引入
store.js
引入
// 页面路径:store/index.js
import Vue from "vue";
import Vuex from "vuex";
import persistence from "./plugins/persistence";
Vue.use(Vuex);
const store = new Vuex.Store({
// 使用模块
plugins: [persistence()],
});
export default store;
api
persistence(key)
key 是你设置 本地存储的 key 的名称,如果不传,默认就是 vuex-uniapp-persistence
联系我
- yeah126139163@163.com
- https://github.com/itcastWsy/vuex-uniapp-persistence