<wxs module="computed" src="./index.wxs" />
<wxs module="utils" src="../wxs/utils.wxs" />

<view class="aio-swiper aio-class" style="{{ computed.rootStyle({ width, height, radius }) }}">
  <swiper
			class="aio-swiper__wrapper"
			style="height:{{ utils.addUnit(height, 'rpx') }}"
			circular="{{ circular }}"
			interval="{{ interval }}"
			duration="{{ duration }}"
			autoplay="{{ autoplay }}"
			current="{{ current }}"
			currentItemId="{{ currentItemId }}"
			previousMargin="{{ utils.addUnit(previousMargin, 'rpx') }}"
			nextMargin="{{ utils.addUnit(nextMargin, 'rpx') }}"
			acceleration="{{ acceleration }}"
			displayMultipleItems="{{ displayMultipleItems }}"
			easingFunction="{{ easingFunction }}"
      bindchange="change"
		>
			<swiper-item
				class="aio-swiper__wrapper__item"
				wx:for="{{ list }}"
				wx:key="index"
			>
				<view class="aio-swiper__wrapper__item__wrapper" style="{{ computed.itemStyle(radius, nextMargin, previousMargin, index, currentIndex) }}">
          <image
						class="aio-swiper__wrapper__item__wrapper__image"
						wx:if="{{ computed.getItemType(item, keyName) === 'image' }}"
						src="{{ computed.getSource(item, keyName) }}"
						mode="{{ imgMode }}"
            data-index="{{ index }}"
						bind:tap="clickHandler"
						style="{{ computed.imageStyle({ height, radius }) }}"
					></image>
          <video
						class="aio-swiper__wrapper__item__wrapper__video"
						wx:if="{{ computed.getItemType(item, keyName) === 'video' }}"
						id="swiper-video-{{ index }}"
						enable-progress-gesture="{{ false }}"
						src="{{ computed.getSource(item, keyName) }}"
						style="height:{{ utils.addUnit(height, 'rpx') }}"
            data-index="{{ index }}"
            controls
						bind:tap="clickHandler"
					></video>
        </view>
			</swiper-item>
		</swiper>
    <view class="aio-swiper__indicator" style="{{ indicatorStyle }}">
			<slot wx:if="{{ useIndicatorSlot }}" name="indicator" />
      <aio-swiper-indicator
					wx:elif="{{ !useIndicatorSlot && indicator }}"
					indicatorActiveColor="{{ indicatorActiveColor }}"
					indicatorInactiveColor="{{ indicatorInactiveColor }}"
					length="{{ list.length }}"
					current="{{ currentIndex }}"
					indicatorMode="{{ indicatorMode }}"
				></aio-swiper-indicator>
		</view>
</view>