uni-menu-sidebar.vue 906 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <view class="pointer">
  3. <template v-for="(item,index) in data">
  4. <template v-if="!item.children || !item.children.length">
  5. <uni-menu-item :index="item">
  6. <view :class="item.icon"></view>
  7. <text :class="{title: item.icon}">{{item.text}}</text>
  8. </uni-menu-item>
  9. </template>
  10. <uni-sub-menu v-else :index="item">
  11. <template v-slot:title>
  12. <view :class="item.icon"></view>
  13. <text :class="{title: item.icon}">{{item.text}}</text>
  14. </template>
  15. <uni-menu-sidebar class="item-bg" :data="item.children" :key="item._id" />
  16. </uni-sub-menu>
  17. </template>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'uniMenuSidebar',
  23. props: {
  24. data: {
  25. type: Array,
  26. default () {
  27. return []
  28. }
  29. }
  30. },
  31. data() {
  32. return {};
  33. },
  34. computed: {
  35. },
  36. methods: {
  37. }
  38. }
  39. </script>
  40. <style lang="scss">
  41. .title {
  42. margin-left: 5px;
  43. }
  44. </style>