index.wxml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <view class="i-modal-mask i-class-mask {{ visible ? 'i-modal-mask-show' : '' }}"></view>
  2. <view class="i-class i-modal {{ visible ? 'i-modal-show' : '' }}">
  3. <view class="i-modal-main">
  4. <view class="i-modal-content">
  5. <view class="i-modal-title" wx:if="{{ title }}">{{ title }}</view>
  6. <view class="i-modal-body"><slot></slot></view>
  7. <view class="i-modal-actions" wx:if="{{ actions.length }}">
  8. <block wx:if="{{ actionMode === 'horizontal' }}">
  9. <i-grid i-class="i-modal-grid">
  10. <i-grid-item i-class="{{ actions.length === (index + 1) ? 'i-modal-grid-item-last' : 'i-modal-grid-item' }}" wx:for="{{ actions }}" wx:key="{{ item.name }}">
  11. <template is="button" data="{{ item, index }}"></template>
  12. </i-grid-item>
  13. </i-grid>
  14. </block>
  15. <block wx:else>
  16. <view class="i-modal-action-vertical" wx:for="{{ actions }}" wx:key="{{ item.name }}">
  17. <template is="button" data="{{ item, index }}"></template>
  18. </view>
  19. </block>
  20. </view>
  21. <view class="i-modal-actions" wx:else>
  22. <i-grid i-class="i-modal-grid" wx:if="{{ showOk || showCancel }}">
  23. <i-grid-item i-class="i-modal-grid-item" wx:if="{{ showCancel }}">
  24. <i-button i-class="i-modal-btn-cancel" long type="ghost" bind:click="handleClickCancel">{{ cancelText }}</i-button>
  25. </i-grid-item>
  26. <i-grid-item i-class="i-modal-grid-item-last" wx:if="{{ showOk }}">
  27. <i-button i-class="i-modal-btn-ok" long type="ghost" bind:click="handleClickOk">{{ okText }}</i-button>
  28. </i-grid-item>
  29. </i-grid>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <template name="button">
  35. <i-button long type="ghost" data-index="{{ index }}" bind:click="handleClickItem">
  36. <view class="i-modal-btn-loading" wx:if="{{ item.loading }}"></view>
  37. <i-icon wx:if="{{ item.icon }}" type="{{ item.icon }}" i-class="i-modal-btn-icon"></i-icon>
  38. <view class="i-modal-btn-text" style="{{ item.color ? 'color: ' + item.color : '' }}">{{ item.name }}</view>
  39. </i-button>
  40. </template>