You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SidebarItem.vue 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <template v-for="(item, index) in list" :key="item.path">
  3. <!-- 父级菜单 -->
  4. <el-sub-menu v-if="item.children && item.children.length > 0" :index="item.title + ',' + item.path">
  5. <template #title>
  6. <Item />
  7. <span style="font-size:14px">{{ item.title }}</span>
  8. </template>
  9. <el-menu-item-group>
  10. <sidebarItem :list="item.children"></sidebarItem>
  11. </el-menu-item-group>
  12. </el-sub-menu>
  13. <!-- 子项也负责跳转 -->
  14. <router-link style="text-decoration: none;" v-else :to="{name:`${item.path}`}">
  15. <el-menu-item class="el-menu-item" :index="item.title + ',' + item.path">
  16. <!-- <Item /> -->
  17. <template #title>
  18. <span style="font-size:14px">{{ item.title }}</span>
  19. </template>
  20. </el-menu-item>
  21. </router-link>
  22. </template>
  23. </template>
  24. <script lang="ts">
  25. import {
  26. Document,
  27. Menu as IconMenu,
  28. Location,
  29. Setting
  30. } from '@element-plus/icons-vue'
  31. import Item from './Item.vue'
  32. export default {
  33. name: 'SidebarItem',
  34. components: {
  35. Item
  36. },
  37. props: {
  38. list: {
  39. type: Array,
  40. default: function () {
  41. return []
  42. },
  43. },
  44. },
  45. }
  46. </script>
  47. <style lang="less" scoped>
  48. </style>