Vuex 中 使用 Action 處理異步請求時,常規寫法以下:html
getMenuAction:(context) =>{ context.commit('SET_MENU_LIST',['承保2','覈保2']) } }
咱們也可使用以下簡化寫法,以下:異步
actions:{ getMenuAction:({commit}) =>{ commit('SET_MENU_LIST',['承保2','覈保2']) } }
參照原文章post
https://www.cnblogs.com/xianrongbin/p/2781659.htmlurl