routesList.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Module } from 'vuex';
  2. import { RoutesListState, RootStateTypes } from '/@/store/interface/index';
  3. const routesListModule: Module<RoutesListState, RootStateTypes> = {
  4. namespaced: true,
  5. state: {
  6. routesList: [],
  7. isColumnsMenuHover: false,
  8. isColumnsNavHover: false,
  9. },
  10. mutations: {
  11. // 设置路由,菜单中使用到
  12. getRoutesList(state: any, data: Array<object>) {
  13. state.routesList = data;
  14. },
  15. // 设置分栏布局,鼠标是否移入移出(菜单)
  16. getColumnsMenuHover(state: any, bool: Boolean) {
  17. state.isColumnsMenuHover = bool;
  18. },
  19. // 设置分栏布局,鼠标是否移入移出(导航)
  20. getColumnsNavHover(state: any, bool: Boolean) {
  21. state.isColumnsNavHover = bool;
  22. },
  23. },
  24. actions: {
  25. // 设置路由,菜单中使用到
  26. async setRoutesList({ commit }, data: any) {
  27. commit('getRoutesList', data);
  28. },
  29. // 设置分栏布局,鼠标是否移入移出(菜单)
  30. async setColumnsMenuHover({ commit }, bool: Boolean) {
  31. commit('getColumnsMenuHover', bool);
  32. },
  33. // 设置分栏布局,鼠标是否移入移出(菜单)
  34. async setColumnsNavHover({ commit }, bool: Boolean) {
  35. commit('getColumnsNavHover', bool);
  36. },
  37. },
  38. };
  39. export default routesListModule;