vuex-persistedstate插件的安装和使用
作者:互联网
安装
npm install vuex-persistedstate --save
在store.js中引入
import Vue from 'vue';
import Vuex from 'vuex';
//Add this line
import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex);
export default new Vuex.Store({
//Add this line
plugins: [createPersistedState()],
state: {
lists: [],
},
mutations: {
addItem(state,value){
state.lists.push(value)
},
},
actions: {
},
});
原文链接:https://blog.csdn.net/Jane_3210/article/details/88309153
标签:插件,vuex,Add,state,persistedstate,import,Vuex 来源: https://www.cnblogs.com/panghu123/p/11747331.html