const menu =  {
  state: {
    menuList: {},
  },
  mutations: {
    setMenu(state, data) {
      for (let item of data) {
        let action = item.action.split(':');
        item.value = action[1]
        if (state.menuList[action[0]] == undefined) {
          state.menuList[action[0]] = [];
        }
        state.menuList[action[0]].push(item);
      }
    },
    setStatisticsMenu(state, item) {
      state.menuList['statistics'] = item.children;

    },
  },
  getter: {
    // 获取
    getMenuList: (state) => (key) => {
      return state.menuList[key];
    },
  }


}

export default menu;