image-viewer.wxml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <view wx:if="{{visible}}" id="{{classPrefix}}" class="{{classPrefix}} {{prefix}}-class">
  2. <view class="{{classPrefix}}__mask" style="{{ 'background-color: ' + backgroundColor }}" />
  3. <block wx:if="{{images && images.length}}">
  4. <view slot="content" class="{{classPrefix}}__content">
  5. <t-swiper
  6. height="{{windowHeight * 2}}"
  7. t-class="swiper"
  8. autoplay="{{false}}"
  9. current="{{currentSwiperIndex}}"
  10. bindchange="onSwiperChange"
  11. >
  12. <t-swiper-item
  13. wx:for="{{images}}"
  14. wx:key="index"
  15. class="{{classPrefix}}__preview-image"
  16. data-source="overlay"
  17. bind:tap="onClose"
  18. >
  19. <t-image
  20. t-class="t-image--external"
  21. style="{{imagesShape[index].style}}"
  22. mode="aspectFit"
  23. lazy
  24. src="{{item}}"
  25. data-index="{{index}}"
  26. class="{{classPrefix}}__image"
  27. bindload="onImageLoadSuccess"
  28. ></t-image>
  29. </t-swiper-item>
  30. </t-swiper>
  31. </view>
  32. <view class="{{classPrefix}}__nav">
  33. <t-icon
  34. wx:if="{{closeBtn}}"
  35. name="close"
  36. size="xl"
  37. class="{{classPrefix}}__nav-close {{classPrefix}}__nav-icon"
  38. data-source="button"
  39. bind:click="onClose"
  40. ></t-icon>
  41. <slot name="closeBtn" />
  42. <view wx:if="{{showIndex}}" class="{{classPrefix}}__nav-index">
  43. {{currentSwiperIndex + 1}}/{{images.length}}
  44. </view>
  45. <t-icon
  46. wx:if="{{deleteBtn}}"
  47. name="delete"
  48. size="xl"
  49. class="{{classPrefix}}__nav-delete {{classPrefix}}__nav-icon"
  50. bind:click="onDelete"
  51. ></t-icon>
  52. <slot name="deleteBtn" />
  53. </view>
  54. </block>
  55. </view>