diff --git a/package-lock.json b/package-lock.json index 1a15e1d..02828d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,8 @@ "flyio": "^0.6.2", "sass": "^1.62.1", "vue": "^2.6.11", - "vuex": "^3.2.0" + "vuex": "^3.2.0", + "vuex-uniapp-persistence": "^1.0.1" }, "devDependencies": { "@dcloudio/types": "^3.3.2", @@ -19348,6 +19349,14 @@ "vue": "^2.0.0" } }, + "node_modules/vuex-uniapp-persistence": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/vuex-uniapp-persistence/-/vuex-uniapp-persistence-1.0.1.tgz", + "integrity": "sha512-1Ysvg8yf3gpZuzLev5yPkp+ZP1kFcK/m4sAqspeVPFvOsMUEpjhjT/emLBd/eiUhjN8/fmjO7aUcNoU+KvIwSg==", + "dependencies": { + "lodash": "^4.17.21" + } + }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -36115,6 +36124,14 @@ "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", "requires": {} }, + "vuex-uniapp-persistence": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/vuex-uniapp-persistence/-/vuex-uniapp-persistence-1.0.1.tgz", + "integrity": "sha512-1Ysvg8yf3gpZuzLev5yPkp+ZP1kFcK/m4sAqspeVPFvOsMUEpjhjT/emLBd/eiUhjN8/fmjO7aUcNoU+KvIwSg==", + "requires": { + "lodash": "^4.17.21" + } + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", diff --git a/package.json b/package.json index 514eb99..444126f 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,8 @@ "flyio": "^0.6.2", "sass": "^1.62.1", "vue": "^2.6.11", - "vuex": "^3.2.0" + "vuex": "^3.2.0", + "vuex-uniapp-persistence": "^1.0.1" }, "devDependencies": { "@dcloudio/types": "^3.3.2", diff --git a/src/store/index.js b/src/store/index.js index df7a581..7adf63e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,12 +1,15 @@ // 页面路径:store/index.js import Vue from 'vue'; import Vuex from 'vuex'; +import persistence from 'vuex-uniapp-persistence'; Vue.use(Vuex); //vue的插件机制 //Vuex.Store 构造器选项 const store = new Vuex.Store({ + // 使用模块 state: {}, getters: {}, modules: {}, + plugins: [persistence()], //持久化插件 }); export default store;