Menu.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <a-layout id="app-menu">
  3. <a-layout-sider
  4. theme="light"
  5. class="layout-sider"
  6. >
  7. <a-menu theme="light" mode="inline" :default-selected-keys="['menu_100']">
  8. <a-menu-item v-for="(menuInfo, subIndex) in menu" :key="subIndex">
  9. <router-link :to="{ name: menuInfo.pageName, params: menuInfo.params}">
  10. <span>{{ menuInfo.title }}</span>
  11. </router-link>
  12. </a-menu-item>
  13. </a-menu>
  14. </a-layout-sider>
  15. <a-layout>
  16. <a-layout-content>
  17. <router-view />
  18. </a-layout-content>
  19. </a-layout>
  20. </a-layout>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. menu: {
  27. 'menu_100' : {
  28. icon: 'profile',
  29. title: '文件',
  30. pageName: 'BaseFileIndex',
  31. params: {}
  32. },
  33. 'menu_300' : {
  34. icon: 'profile',
  35. title: '通信',
  36. pageName: 'BaseSocketIndex',
  37. params: {}
  38. },
  39. 'menu_301' : {
  40. icon: 'profile',
  41. title: '数据库',
  42. pageName: 'BaseDBIndex',
  43. params: {}
  44. },
  45. 'menu_400' : {
  46. icon: 'profile',
  47. title: '视图',
  48. pageName: 'BaseWindowViewIndex',
  49. params: {}
  50. },
  51. 'menu_401' : {
  52. icon: 'profile',
  53. title: '窗口',
  54. pageName: 'BaseWindowIndex',
  55. params: {}
  56. },
  57. 'menu_403' : {
  58. icon: 'profile',
  59. title: '扩展程序',
  60. pageName: 'BaseExtensionIndex',
  61. params: {}
  62. },
  63. 'menu_405' : {
  64. icon: 'profile',
  65. title: '桌面通知',
  66. pageName: 'BaseNotificationIndex',
  67. params: {}
  68. },
  69. 'menu_407' : {
  70. icon: 'profile',
  71. title: '电源监控',
  72. pageName: 'BasePowerMonitorIndex',
  73. params: {}
  74. },
  75. 'menu_409' : {
  76. icon: 'profile',
  77. title: '屏幕信息',
  78. pageName: 'BaseScreenIndex',
  79. params: {}
  80. },
  81. 'menu_411' : {
  82. icon: 'profile',
  83. title: '系统主题',
  84. pageName: 'BaseThemeIndex',
  85. params: {}
  86. },
  87. 'menu_412' : {
  88. icon: 'profile',
  89. title: '自动更新',
  90. pageName: 'BaseUpdaterIndex',
  91. params: {}
  92. },
  93. 'menu_500' : {
  94. icon: 'profile',
  95. title: '软件调用',
  96. pageName: 'BaseSoftwareIndex',
  97. params: {}
  98. },
  99. 'menu_900' : {
  100. icon: 'profile',
  101. title: '测试',
  102. pageName: 'BaseTestApiIndex',
  103. params: {}
  104. }
  105. }
  106. };
  107. },
  108. created () {
  109. },
  110. mounted () {
  111. this.menuHandle({key: 'menu_100'})
  112. },
  113. methods: {
  114. menuHandle (item) {
  115. const linkInfo = this.menu[item.key]
  116. this.$router.push({ name: linkInfo.pageName, params: linkInfo.params})
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="less" scoped>
  122. #app-menu {
  123. height: 100%;
  124. text-align: center;
  125. .layout-sider {
  126. border-top: 1px solid #e8e8e8;
  127. border-right: 1px solid #e8e8e8;
  128. background-color: #FAFAFA;
  129. overflow: auto;
  130. }
  131. }
  132. </style>