menu.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { reactive, h } from 'vue'
  2. import { renderIcon } from '@/utils'
  3. import { RouterLink } from 'vue-router'
  4. import { PageEnum } from '@/enums/pageEnum'
  5. import { MenuOption, MenuGroupOption } from 'naive-ui'
  6. import { icon } from '@/plugins'
  7. const { GridIcon, BeerIcon, DesktopIcon, LaptopOutlineIcon } = icon.ionicons5
  8. export const renderMenuLabel = (option: MenuOption | MenuGroupOption) => {
  9. return option.label
  10. }
  11. export const expandedKeys = () => ['all-project']
  12. export const menuOptionsInit = () => {
  13. return reactive([
  14. {
  15. key: 'divider-1',
  16. type: 'divider'
  17. },
  18. {
  19. label: '项目',
  20. key: 'all-project',
  21. icon: renderIcon(GridIcon),
  22. children: [
  23. {
  24. type: 'group',
  25. label: '我的',
  26. key: 'my-project',
  27. children: [
  28. {
  29. label: () =>
  30. h(
  31. RouterLink,
  32. {
  33. to: {
  34. name: PageEnum.BASE_HOME_ITEMS_NAME
  35. }
  36. },
  37. { default: () => '全部项目' }
  38. ),
  39. key: PageEnum.BASE_HOME_ITEMS_NAME,
  40. icon: renderIcon(DesktopIcon)
  41. },
  42. {
  43. label: () =>
  44. h(
  45. RouterLink,
  46. {
  47. to: {
  48. name: PageEnum.BASE_HOME_TEMPLATE_NAME
  49. }
  50. },
  51. { default: () => '我的物料' }
  52. ),
  53. key: PageEnum.BASE_HOME_TEMPLATE_NAME,
  54. icon: renderIcon(LaptopOutlineIcon)
  55. }
  56. ]
  57. }
  58. ]
  59. },
  60. {
  61. key: 'divider-2',
  62. type: 'divider'
  63. },
  64. {
  65. label: () =>
  66. h(
  67. RouterLink,
  68. {
  69. to: {
  70. name: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME
  71. }
  72. },
  73. { default: () => '物料市场' }
  74. ),
  75. key: PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME,
  76. icon: renderIcon(BeerIcon)
  77. }
  78. ])
  79. }