Aside.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <el-menu
  3. :default-active="this.$store.state.currentMenuItem"
  4. style="width: 220px; height: 100%"
  5. background-color="#141B29"
  6. text-color="#fff"
  7. active-text-color="#ffd04b"
  8. :router="true"
  9. >
  10. <el-sub-menu v-for="(item, index) in menu" :key="item" :index="index + ''">
  11. <template v-slot:title>
  12. <el-icon :size="18">
  13. <component :is="item.icon" />
  14. </el-icon>
  15. <span>{{ item.title }}</span>
  16. </template>
  17. <el-menu-item
  18. v-for="son in item.items"
  19. :index="son.path"
  20. :key="son"
  21. @click="changeIndex(son.path)"
  22. >
  23. {{ son.name }}
  24. </el-menu-item>
  25. </el-sub-menu>
  26. </el-menu>
  27. </template>
  28. <script>
  29. import { ref } from "vue";
  30. export default {
  31. setup() {
  32. let defaultActive = ref();
  33. function changeIndex(path) {
  34. defaultActive.value = path;
  35. }
  36. let menu = [
  37. {
  38. icon: "Fold",
  39. title: "航次管理",
  40. items: [
  41. {
  42. path: "/voyage/voyageList",
  43. name: "航次列表",
  44. },
  45. ],
  46. },
  47. {
  48. icon: "userFilled",
  49. title: "货主信息",
  50. items: [
  51. {
  52. path: "/cargoOwnerManage/cargoOwnerCompanyList",
  53. name: "货主公司列表",
  54. },
  55. ],
  56. },
  57. {
  58. icon: "User",
  59. title: "代理信息",
  60. items: [
  61. {
  62. path: "/agencyManage/agencyCompanyList",
  63. name: "代理公司列表",
  64. },
  65. ],
  66. },
  67. {
  68. icon: "Avatar",
  69. title: "船东信息",
  70. items: [
  71. {
  72. path: "/shipOwnerManage/shipOwnerList",
  73. name: "船东列表",
  74. },
  75. ],
  76. },
  77. {
  78. icon: "Ship",
  79. title: "船舶信息",
  80. items: [
  81. {
  82. path: "/shipManage/shipList",
  83. name: "船舶列表",
  84. },
  85. ],
  86. },
  87. {
  88. icon: "Place",
  89. title: "港口信息",
  90. items: [
  91. {
  92. path: "/portsManage/portsList",
  93. name: "港口列表",
  94. },
  95. {
  96. path: "/portsManage/sailingSchedule",
  97. name: "航期维护",
  98. },
  99. ],
  100. },
  101. {
  102. icon: "Magnet",
  103. title: "航次区块链",
  104. items: [
  105. {
  106. path: "/toolManage/blockChain",
  107. name: "航次上链",
  108. },
  109. ],
  110. },
  111. {
  112. icon: "Document",
  113. title: "版本日志",
  114. items: [
  115. {
  116. path: "/toolManage/versions",
  117. name: "版本日志",
  118. },
  119. ],
  120. },
  121. ];
  122. return {
  123. changeIndex,
  124. defaultActive,
  125. menu,
  126. };
  127. },
  128. };
  129. </script>
  130. <style scoped>
  131. .el-sub-menu__title i {
  132. height: 20px;
  133. margin-right: 10px;
  134. }
  135. </style>