uni-menu-group.vue 798 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="uni-menu-group">
  3. <view class="uni-menu-group__title" name="title" :style="{paddingLeft:paddingLeft}">{{title}}</view>
  4. <slot></slot>
  5. </view>
  6. </template>
  7. <script>
  8. import rootParent from '../uni-nav-menu/mixins/rootParent.js'
  9. export default {
  10. name: 'uniMenuGroup',
  11. mixins:[rootParent],
  12. props: {
  13. title: String
  14. },
  15. data() {
  16. return {
  17. };
  18. },
  19. computed: {
  20. paddingLeft() {
  21. return 20+20 * this.rootMenu.SubMenu.length + 'px'
  22. }
  23. },
  24. created() {
  25. this.init()
  26. },
  27. methods: {
  28. init() {
  29. this.rootMenu = {
  30. SubMenu: []
  31. }
  32. this.getParentAll('SubMenu', this)
  33. }
  34. }
  35. }
  36. </script>
  37. <style>
  38. .uni-menu-group {
  39. /* border: 1px red solid; */
  40. }
  41. .uni-menu-group__title {
  42. line-height: 36px;
  43. font-size: 12px;
  44. color: #999;
  45. }
  46. </style>