vue固化插件
作者:互联网
下载 npm i vuex-persist --save
引入import vuexPersist from "vuex-persist";
使用
export default new Vuex.Store({
state: {
userlist: [],
},
mutations: {
setuser(state, val) {
state.userlist.push(val);
},
},
actions: {},
modules: {},
plugins: [
new vuexPersist({
storage: window.localStorage,
}).plugin,
],
});
把下边的代码放在store问价夹里面index.js里面
plugins: [
new vuexPersist({
storage: window.localStorage,
}).plugin,
],
标签:插件,vue,val,storage,state,vuexPersist,plugins,new,固化 来源: https://blog.csdn.net/m0_63873004/article/details/122456411