menu.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="menu-contente">
  3. <Menu mode="horizontal" :active-name="activeName">
  4. <template v-for='(item, index) in menulist'>
  5. <template v-if='!!!item.children'>
  6. <MenuItem :name="item.link" :to='item.link'>
  7. <Icon v-if="item.icon" :type="item.icon" color="#1874ff" />
  8. {{item.name}}
  9. </MenuItem>
  10. </template>
  11. <template v-else>
  12. <submenu :name="item.name">
  13. <template slot="title">
  14. {{item.name}}
  15. </template>
  16. <template v-for='i in item.children'>
  17. <MenuItem :to='i.link' :name="i.name">{{i.name}}</MenuItem>
  18. </template>
  19. </submenu>
  20. </template>
  21. </template>
  22. <div class="current-baled"> <Tag :color="status == 2 ? 'red' : 'success'">当前模块:{{currentIndex}}h - {{currName}}</Tag></div>
  23. </Menu>
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'allmenu',
  29. data() {
  30. return {
  31. theme: '',
  32. activeName: this.$route.name,
  33. menulist: [
  34. {
  35. name: "总览",
  36. link: 'dashbord',
  37. icon: 'ios-home',
  38. isdisabel: false
  39. },
  40. {
  41. name: "风扇控制",
  42. link: 'fan',
  43. icon: 'md-aperture',
  44. isdisabel: false
  45. },
  46. {
  47. name: "FRU信息",
  48. link: 'fru_info',
  49. icon: 'ios-grid',
  50. isdisabel: false
  51. },
  52. {
  53. name: "传感器设置",
  54. link:'sensor_history',
  55. icon: 'md-analytics',
  56. isdisabel: false,
  57. },
  58. {
  59. name: "日志",
  60. isdisabel: false,
  61. icon: 'ios-list-box-outline',
  62. link: 'event_logs'
  63. },
  64. {
  65. name: "电源控制",
  66. isdisabel: false,
  67. icon: 'md-power',
  68. link: 'RemotPwrCtrl',
  69. },
  70. {
  71. name: "设置",
  72. link: "setting",
  73. isDisabel: false,
  74. icon: 'ios-cog-outline',
  75. }
  76. ]
  77. }
  78. },
  79. computed:{
  80. currName(){
  81. return this.$store.state.currentblade.name
  82. },
  83. currentIndex(){
  84. return this.$store.state.currentblade.slot
  85. },
  86. status(){
  87. return this.$store.state.currentblade.status
  88. }
  89. },
  90. watch: {
  91. $route: function () {
  92. this.activeName = this.$route.link
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang='scss' scoped>
  98. .menu-contente {
  99. /*position: fixed;*/
  100. width: 1180px;
  101. /*top: 0px;
  102. left: 0px;
  103. right: 0px;*/
  104. margin-left: auto;
  105. margin-right: auto;
  106. }
  107. .current-baled{
  108. color:#1874ff;
  109. float: right;
  110. margin-right: 10px;
  111. }
  112. </style>