在js文件中引入Vuex
在js文件中引入Vuex由于这个vuex是一个整体,所以必须把store文件夹整个引入到文件中,即import store from 'xxxxx/store'引入state:store.state.(modules).(name):store.state.editor.currentPageId引入gettres:store.getters['(modules)/(name)']:store.g
·
在js文件中引入Vuex
由于这个vuex是一个整体,所以必须把store文件夹整个引入到文件中,即import store from 'xxxxx/store'
- 引入state:
store.state.(modules).(name)
:store.state.editor.currentPageId
- 引入gettres:
store.getters['(modules)/(name)']
:store.getters[‘editor/currentActiveElementData’]
- 引入mutations:
store.commit('(modules)/(method)', payload)
:store.commit(‘editor/setCurrentActiveElementIdList’, {list: idList})
- 引入actions:
store.dispatch('(modules)/(method)', payload)
更多推荐
已为社区贡献1条内容
所有评论(0)