groupStore.js 415 B

12345678910111213141516171819202122232425
  1. import httpRequest from '../api/httpRequest.js'
  2. export default {
  3. state: {
  4. groups: [],
  5. activeIndex: -1,
  6. },
  7. mutations: {
  8. initGroupStore(state) {
  9. httpRequest({
  10. url: '/api/group/list',
  11. method: 'get'
  12. }).then((groups) => {
  13. this.commit("setGroups",groups);
  14. })
  15. },
  16. setGroups(state,groups){
  17. state.groups = groups;
  18. },
  19. activeGroup(state,index){
  20. state.activeIndex = index;
  21. }
  22. }
  23. }