<view class="i-modal-mask i-class-mask {{ visible ? 'i-modal-mask-show' : '' }}"></view>
<view class="i-class i-modal {{ visible ? 'i-modal-show' : '' }}">
  <view class="i-modal-main">
    <view class="i-modal-content">
      <view class="i-modal-title" wx:if="{{ title }}">{{ title }}</view>
      <view class="i-modal-body">
        <slot></slot>
      </view>
      <view class="i-modal-actions" wx:if="{{ actions.length }}">
        <block wx:if="{{ actionMode === 'horizontal' }}">
          <i-grid i-class="i-modal-grid">
            <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 }}">
              <template is="button" data="{{ item, index }}"></template>
            </i-grid-item>
          </i-grid>
        </block>
        <block wx:else>
          <view class="i-modal-action-vertical" wx:for="{{ actions }}" wx:key="{{ item.name }}">
            <template is="button" data="{{ item, index }}"></template>
          </view>
        </block>
      </view>
      <view class="i-modal-actions" wx:else>
        <i-grid i-class="i-modal-grid" wx:if="{{ showOk || showCancel }}">
          <i-grid-item i-class="i-modal-grid-item" wx:if="{{ showCancel }}">
            <i-button i-class="i-modal-btn-cancel" long type="ghost" bind:click="handleClickCancel">{{ cancelText }}</i-button>
          </i-grid-item>
          <i-grid-item i-class="i-modal-grid-item-last" wx:if="{{ showOk }}">
            <i-button i-class="i-modal-btn-ok" long type="ghost" bind:click="handleClickOk">{{ okText }}</i-button>
          </i-grid-item>
        </i-grid>
      </view>
    </view>
  </view>
</view>
<template name="button">
  <i-button long type="ghost" data-index="{{ index }}" bind:click="handleClickItem">
    <view class="i-modal-btn-loading" wx:if="{{ item.loading }}"></view>
    <i-icon wx:if="{{ item.icon }}" type="{{ item.icon }}" i-class="i-modal-btn-icon"></i-icon>
    <view class="i-modal-btn-text" style="{{ item.color ? 'color: ' + item.color : '' }}">{{ item.name }}</view>
  </i-button>
</template>