loading.wxml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <wxs src="../common/utils.wxs" module="utils" />
  2. <view class="{{prefix}}-class">
  3. <view
  4. wx:if="{{theme === 'bar' && theme !== 'error'}}"
  5. style="{{progress >= 0 ? 'width:' + progress + '%' : ''}}"
  6. class="{{prefix}}-class-indicator {{classPrefix}}__bar {{classPrefix}}__bar--{{progress < 0 ? 'animation' : progress < 100 ? 'static': ''}} {{progress >= 100 || !loading ? classPrefix + '__bar--loaded' : ''}}"
  7. ></view>
  8. <view class="{{classPrefix}} {{classPrefix + '--' + layout}}" style="{{show ? '' : 'display:none'}}" wx:else>
  9. <view
  10. wx:if="{{ theme !== 'error' }}"
  11. class="{{prefix}}-class-indicator {{classPrefix}}__spinner {{classPrefix}}__spinner--{{ theme }} {{reverse ? 'reverse' : ''}}"
  12. style="width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}; {{inheritColor ? 'color: inherit' : ''}} {{indicator ? '' : 'display:none'}}; {{duration ? 'animation-duration: ' + duration / 1000 + 's;' : ''}} animation-play-state: {{pause ? 'paused' : 'running'}};"
  13. >
  14. <view
  15. wx:if="{{ theme === 'spinner' }}"
  16. wx:for="{{[1,2,3,4,5,6,7,8,9,10,11,12]}}"
  17. wx:key="index"
  18. class="{{classPrefix}}__dot"
  19. />
  20. <view wx:if="{{ theme === 'circular' }}" class="{{classPrefix}}__circular" />
  21. <block wx:if="{{ theme === 'dots' }}">
  22. <view
  23. class="{{classPrefix}}__dot"
  24. style="{{duration ? 'animation-duration: ' + duration/1000 + 's; animation-delay:' + 0 + 's;' : ''}} animation-play-state: {{pause ? 'paused' : 'running'}};"
  25. ></view>
  26. <view
  27. class="{{classPrefix}}__dot"
  28. style="{{duration ? 'animation-duration: ' + duration/1000 + 's; animation-delay:' + duration * 1 / 3000 + 's;' : ''}} animation-play-state: {{pause ? 'paused' : 'running'}};"
  29. ></view>
  30. <view
  31. class="{{classPrefix}}__dot"
  32. style="{{duration ? 'animation-duration: ' + duration/1000 + 's; animation-delay:' + duration * 2 / 3000 + 's;' : ''}} animation-play-state: {{pause ? 'paused' : 'running'}};"
  33. ></view>
  34. </block>
  35. </view>
  36. <view class="{{prefix}}-class-text">
  37. <view wx:if="{{theme === 'error'}}">
  38. <span>加载失败</span>
  39. <span class="{{classPrefix}}__refresh-btn" bind:tap="refreshPage">刷新</span>
  40. </view>
  41. <view class="{{classPrefix}}__text" wx:if="{{text}}">
  42. <text wx:if="{{text !== 'slot'}}"> {{text}} </text>
  43. <slot name="text" />
  44. </view>
  45. </view>
  46. </view>
  47. </view>