collapse-panel.wxml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <wxs src="../common/utils.wxs" module="utils" />
  2. <view
  3. class="{{ classPrefix }} custom-class {{ index !== 0 ? classBasePrefix + '-hairline--top' : '' }}"
  4. >
  5. <t-cell
  6. title="{{ title }}"
  7. title-class="title-class"
  8. rightIcon="{{ icon }}"
  9. value="{{ extra }}"
  10. label="{{ label }}"
  11. is-link="{{ isLink }}"
  12. clickable="{{ clickable }}"
  13. border="{{ border && expanded }}"
  14. class="{{ classPrefix }}__title {{disabled? classPrefix + '__title--disabled':''}} {{expanded? classPrefix + '__title--expanded':''}}"
  15. right-icon-class=" {{ classBasePrefix }}-cell__right-icon"
  16. custom-class="{{ classBasePrefix }}-cell"
  17. hover-class="{{ classBasePrefix }}-cell--hover"
  18. bind:click="onClick"
  19. >
  20. <slot name="title" slot="title" />
  21. <slot name="icon" slot="icon" />
  22. <slot name="extra" />
  23. <slot name="right-icon" slot="right-icon" />
  24. </t-cell>
  25. <view
  26. class="{{ classPrefix }}__wrapper {{transition? classPrefix+'__title--transition':''}}"
  27. style="height: {{ contentHeight }};"
  28. bind:transitionend="onTransitionEnd"
  29. >
  30. <view class="{{ classPrefix }}__content content-class">
  31. <view class="collapse-panel-item" wx:if="{{content && utils.isArray(content)}}">
  32. <view
  33. wx:for="{{content}}"
  34. class="collapse-panel-item-container"
  35. wx:key="index"
  36. wx:for-index="index"
  37. >
  38. <block wx:if="{{utils.isObject(item)}}">
  39. <view class="panel-label" style="{{labelWidth ? 'width:' + labelWidth + 'rpx' : ''}}">
  40. {{item.label}}
  41. </view>
  42. <view class="panel-content"> {{item.content}}</view>
  43. </block>
  44. <block wx:else>
  45. <view class="panel-content"> {{item}}</view>
  46. </block>
  47. </view>
  48. </view>
  49. <view class="collapse-panel-single-item" wx:if="{{content && !utils.isArray(content)}}">
  50. {{content}}
  51. </view>
  52. <block wx:else>
  53. <slot />
  54. </block>
  55. </view>
  56. </view>
  57. </view>