navbar.wxml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <view class="{{classPrefix}} {{fixedClass}} {{visibleClass}} t-class" style="{{boxStyle}}">
  2. <view wx:if="{{fixed}}" class="{{classPrefix}}__placeholder"></view>
  3. <view class="{{classPrefix}}__content" style="{{contentStyle}}">
  4. <block>
  5. <view class="{{classPrefix}}__left t-class-left">
  6. <slot name="capsule" />
  7. <!-- 如果传入leftIcon和homeIcon则展示胶囊 -->
  8. <block wx:if="{{hasBackIcon && hasHomeIcon}}">
  9. <view class="{{classPrefix}}__capsule t-class-capsule">
  10. <view class="{{classPrefix}}__btn t-class-nav-btn" bindtap="goBack">
  11. <t-icon
  12. wx:if="{{leftIcon!=='slot'}}"
  13. name="{{leftIcon}}"
  14. class="{{classPrefix}}__capsule-icon t-class-left-icon"
  15. />
  16. <slot name="left-icon" class="t-class-left-icon"></slot>
  17. </view>
  18. <view class="{{classPrefix}}__btn t-class-nav-btn" bindtap="goHome">
  19. <t-icon
  20. wx:if="{{homeIcon!=='slot'}}"
  21. name="{{homeIcon}}"
  22. class="{{classPrefix}}__capsule-icon t-class-home-icon"
  23. />
  24. <slot name="home-icon" class="t-class-home-icon"></slot>
  25. </view>
  26. </view>
  27. </block>
  28. <!-- 否则无胶囊展示 -->
  29. <block wx:else>
  30. <view wx:if="{{hasBackIcon}}" class="{{classPrefix}}__btn" bindtap="goBack">
  31. <t-icon
  32. wx:if="{{leftIcon!=='slot'}}"
  33. name="{{leftIcon}}"
  34. class="{{classPrefix}}__capsule-icon t-class-left-icon"
  35. />
  36. <slot name="left-icon" class="t-class-left-icon"></slot>
  37. </view>
  38. <view wx:if="{{hasHomeIcon}}" class="{{classPrefix}}__btn" bindtap="goHome">
  39. <t-icon
  40. wx:if="{{homeIcon!=='slot'}}"
  41. name="{{homeIcon}}"
  42. class="{{classPrefix}}__capsule-icon t-class-home-icon"
  43. />
  44. <slot name="home-icon" class="t-class-home-icon"></slot>
  45. </view>
  46. </block>
  47. </view>
  48. <view class="{{classPrefix}}__center t-class-center">
  49. <block wx:if="{{title}}">
  50. <slot wx:if="{{title === 'slot'}}" name="title" class="t-class-title"></slot>
  51. <text wx:else class="{{classPrefix}}__center-title t-class-title">{{showTitle}}</text>
  52. </block>
  53. </view>
  54. </block>
  55. </view>
  56. </view>