Aside.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. <i :class="item.icon"></i>
  13. <span>{{ item.title }}</span>
  14. </template>
  15. <el-menu-item
  16. v-for="son in item.items"
  17. :index="son.path"
  18. :key="son"
  19. @click="changeIndex(son.path)"
  20. >
  21. {{ son.name }}
  22. </el-menu-item>
  23. </el-sub-menu>
  24. </el-menu>
  25. </template>
  26. <script>
  27. import { ref } from "vue";
  28. export default {
  29. setup() {
  30. let defaultActive = ref();
  31. function changeIndex(path) {
  32. defaultActive.value = path;
  33. }
  34. let menu = [
  35. {
  36. icon: "el-icon-s-unfold",
  37. title: "货主信息",
  38. items: [
  39. {
  40. path: "/cargoOwnerManage/cargoOwnerCompanyList",
  41. name: "货主公司列表",
  42. },
  43. ],
  44. },
  45. {
  46. icon: "el-icon-s-unfold",
  47. title: "代理信息",
  48. items: [
  49. {
  50. path: "/agencyManage/agencyCompanyList",
  51. name: "代理公司列表",
  52. },
  53. ],
  54. },
  55. {
  56. icon: "el-icon-s-unfold",
  57. title: "船东信息",
  58. items: [
  59. {
  60. path: "/shipOwnerManage/shipOwnerList",
  61. name: "船东列表",
  62. },
  63. ],
  64. },
  65. {
  66. icon: "el-icon-s-unfold",
  67. title: "船舶信息",
  68. items: [
  69. {
  70. path: "/shipManage/shipList",
  71. name: "船舶列表",
  72. },
  73. ],
  74. },
  75. {
  76. icon: "el-icon-s-unfold",
  77. title: "港口信息",
  78. items: [
  79. {
  80. path: "/portsManage/portsList",
  81. name: "港口列表",
  82. },
  83. {
  84. path: "/portsManage/sailingSchedule",
  85. name: "航期维护",
  86. },
  87. ],
  88. },
  89. {
  90. icon: "el-icon-s-unfold",
  91. title: "航次区块链",
  92. items: [
  93. {
  94. path: "/toolManage/blockChain",
  95. name: "航次上链",
  96. },
  97. ],
  98. },
  99. {
  100. icon: "el-icon-s-unfold",
  101. title: "版本日志",
  102. items: [
  103. {
  104. path: "/toolManage/versions",
  105. name: "版本日志",
  106. },
  107. ],
  108. },
  109. ];
  110. return {
  111. changeIndex,
  112. defaultActive,
  113. menu,
  114. };
  115. },
  116. };
  117. </script>