vuex学习笔记
一.安装
npm install vuex --save
使用
Vue.use(Vuex)
const store = Vuex.Store({
state: {},
mutations: {}, // devtools不支持异步,异步需要action
actions: {}, 异步更新
gettes: {}, // 类似computed
modules: {}
});
state对象添加key/value,不能直接添加属性,否则不是响应式,
Vue.set(state.obj, “key”, “val
原创
2020-10-06 23:35:36 ·
75 阅读 ·
0 评论