index.vue 952 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="menu">
  3. <view class="group" v-for="(menu, index) of menus" :key="index">
  4. <view class="group-title">
  5. <text>{{menu.title}}</text>
  6. </view>
  7. <view class="sub-group" v-for="(item, subIndex) of menu.subs" :key="subIndex">
  8. <view class="sub-item" @click="$emit('clickSub', { path: item.path, params: { a: '1' } })">
  9. <text>{{item.title}}</text>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import menus from './menus'
  17. export default {
  18. data() {
  19. return {
  20. menus,
  21. }
  22. },
  23. mounted() {
  24. }
  25. }
  26. </script>
  27. <style lang="less" scoped>
  28. .menu {
  29. width: 120px;
  30. background: white;
  31. overflow-y: scroll;
  32. .group {
  33. .group-title {
  34. padding: 0 8px;
  35. line-height: 40px;
  36. }
  37. .sub-group {
  38. cursor: pointer;
  39. .sub-item {
  40. text-align: center;
  41. line-height: 32px;
  42. font-size: 12px;
  43. }
  44. }
  45. }
  46. }
  47. </style>