notice-bar.wxml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <import src="../common/template/icon.wxml" />
  2. <wxs src="../common/utils.wxs" module="_" />
  3. <view
  4. wx:if="{{visible}}"
  5. style="{{_._style([style, customStyle])}}"
  6. class="{{classPrefix}} {{classPrefix}}--{{theme}} class {{prefix}}-class"
  7. >
  8. <!-- prefixIcon -->
  9. <view class="{{classPrefix}}__prefix-icon" bind:tap="clickPrefixIcon">
  10. <slot name="prefix-icon" />
  11. <template
  12. wx:if="{{_prefixIcon}}"
  13. is="icon"
  14. data="{{tClass: prefix + '-class-prefix-icon', ..._prefixIcon }}"
  15. ></template>
  16. </view>
  17. <!-- content -->
  18. <view class="{{classPrefix}}__content-wrap" bind:tap="clickContent">
  19. <!-- 垂直滚动通知:基于swiper实现,适用信息量短的多条公告消息,超出省略 -->
  20. <view wx:if="{{ direction === 'vertical' && _.isArray(content) }}">
  21. <swiper
  22. autoplay="true"
  23. vertical="true"
  24. circular="true"
  25. interval="{{interval}}"
  26. display-multiple-items="1"
  27. class="{{classPrefix}}__content {{classPrefix}}__content--vertical"
  28. bindchange="onChange"
  29. >
  30. <block wx:for="{{content}}" wx:key="index">
  31. <swiper-item>
  32. <view class="{{classPrefix}}__content--vertical-item"> {{item}} </view>
  33. </swiper-item>
  34. </block>
  35. </swiper>
  36. </view>
  37. <view
  38. wx:else
  39. class="{{classPrefix}}__content {{prefix}}-class-content {{ !marquee ? classPrefix + '__content-wrapable' : ''}}"
  40. animation="{{ animationData }}"
  41. >
  42. <block wx:if="{{content}}">{{content}}</block>
  43. <slot name="content" />
  44. <view class="{{classPrefix}}__operation {{prefix}}-class-operation" catch:tap="clickOperation">
  45. <block wx:if="{{ operation }}">{{operation}}</block>
  46. <slot name="operation" />
  47. </view>
  48. </view>
  49. </view>
  50. <!-- suffixIcon -->
  51. <view class="{{classPrefix}}__suffix-icon" bind:tap="clickSuffixIcon">
  52. <slot name="suffix-icon" />
  53. <template
  54. wx:if="{{_suffixIcon}}"
  55. is="icon"
  56. data="{{tClass: prefix + '-class-suffix-icon', ..._suffixIcon }}"
  57. ></template>
  58. </view>
  59. </view>