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.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <template v-for="item in list" :key="item.path">
  3. <!-- 父级菜单 -->
  4. <el-sub-menu
  5. v-if="item.children && item.children.length > 0"
  6. :index="item.title + ',' + item.path">
  7. <template #title>
  8. <item-ioc :icon="item.icon" />
  9. <span style="font-size: 14px">{{ item.title }}</span>
  10. </template>
  11. <el-menu-item-group>
  12. <sidebar-item :list="item.children"></sidebar-item>
  13. </el-menu-item-group>
  14. </el-sub-menu>
  15. <!-- 子项也负责跳转 -->
  16. <router-link style="text-decoration: none" v-else :to="{ name: `${item.path}` }">
  17. <el-menu-item class="el-menu-item" :index="item.title + ',' + item.path">
  18. <item-ioc v-if="item.icon" :icon="item.icon" />
  19. <template #title>
  20. <span style="font-size: 14px">{{ item.title }}</span>
  21. </template>
  22. </el-menu-item>
  23. </router-link>
  24. </template>
  25. </template>
  26. <script lang="ts" setup>
  27. defineProps({
  28. list: {
  29. type: <any>Array,
  30. default: [],
  31. },
  32. })
  33. </script>
  34. <style lang="less" scoped>
  35. </style>