notice-bar.wxml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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}} {{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="2000"
  26. display-multiple-items="1"
  27. class="{{classPrefix}}__content--vertical"
  28. >
  29. <block wx:for="{{content}}" wx:key="index">
  30. <swiper-item>
  31. <view class="{{classPrefix}}__content--vertical-item"> {{item}} </view>
  32. </swiper-item>
  33. </block>
  34. </swiper>
  35. </view>
  36. <view
  37. wx:else
  38. class="{{classPrefix}}__content {{prefix}}-class-content {{ !marquee ? classPrefix + '__content-wrapable' : ''}}"
  39. animation="{{ animationData }}"
  40. >
  41. <block wx:if="{{content}}"> {{content}} </block>
  42. <slot name="content" />
  43. </view>
  44. </view>
  45. <!-- extra -->
  46. <view class="{{classPrefix}}__extra {{prefix}}-class-extra" bind:tap="clickExtra">
  47. <block wx:if="{{ extra }}"> {{extra}} </block>
  48. <slot name="extra" />
  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>