Sidebar.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <el-menu default-active="/station/machine" :router="true" v-loading="isLoading"
  3. background-color="#ffffff" text-color="#333" active-text-color="#005eb0" class="o-x-h"
  4. :select="onSelect">
  5. <sidebar-item v-for="item of menuItems" :key="item.title" :menu="item"/>
  6. </el-menu>
  7. </template>
  8. <script>
  9. import SidebarItem from './SidebarItem'
  10. export default {
  11. name: 'Sidebar',
  12. data() {
  13. return {
  14. isLoading: false,
  15. menuTree: [],
  16. menuItems: [
  17. {
  18. title: "油机配置",
  19. icon: "station",
  20. menuItems:[],
  21. action:"/station/machine"
  22. }
  23. // {
  24. // title: "后台配置",
  25. // icon: "backstage",
  26. // menuItems:[],
  27. // action:"/station/data"
  28. // }
  29. ]
  30. }
  31. },
  32. methods: {
  33. onSelect(index,indexPath) {
  34. console.log(`由${index}跳转到${indexPath}`)
  35. }
  36. },
  37. components: {SidebarItem}
  38. }
  39. </script>
  40. <style lang="scss">
  41. .sidebar {
  42. & > ul {
  43. height: 100%;
  44. }
  45. .mock-icon {
  46. font-size: 0;
  47. img {
  48. margin-right: 8px;
  49. }
  50. }
  51. }
  52. </style>