在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)
Logo

前往低代码交流专区

更多推荐