index.js 698 B

12345678910111213141516171819202122232425262728293031323334
  1. const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
  2. export const layouts = [
  3. {
  4. value: 'default',
  5. label: '默认布局',
  6. url: '/header-aside/layout'
  7. },
  8. {
  9. value: 'custom',
  10. label: '自定义布局',
  11. url: '/custom-layout/layout'
  12. }
  13. ]
  14. const layoutComponent = []
  15. layouts.forEach(item => {
  16. layoutComponent[item.value] = _import(item.url, 'layout')
  17. })
  18. /**
  19. * 获取默认布局
  20. */
  21. export function getDefaultLayout() {
  22. return layoutComponent['default']
  23. }
  24. /**
  25. * 获取指定布局
  26. * @param {*} layoutKey
  27. */
  28. export function getLayout(layoutKey) {
  29. if (!layoutKey || layoutKey === '') return getDefaultLayout()
  30. return layoutComponent[layoutKey]
  31. }