component.js 497 B

123456789101112131415161718192021222324252627282930313233
  1. export default {
  2. state: {
  3. info: {},
  4. list: [],
  5. modules: []
  6. },
  7. getters: {
  8. // 组件信息
  9. components: (state) => state.info,
  10. // 组件列表
  11. componentList: (state) => state.list,
  12. // 组件模块
  13. componentModules: (state) => state.modules
  14. },
  15. mutations: {
  16. SET_COMPONENT(state, list) {
  17. let d = {};
  18. list.forEach((e) => {
  19. d[e.name] = e;
  20. });
  21. state.list = list;
  22. state.info = d;
  23. },
  24. SET_COMPONENT_MODULES(state, list) {
  25. state.modules = list;
  26. }
  27. }
  28. };