<template name="grid">
|
<block wx:if="{{gridThemeItems.length === 1}}">
|
<t-grid align="center" t-class="{{classPrefix}}__grid" column="{{count / 2}}" class="{{classPrefix}}__single-wrap">
|
<t-grid-item
|
t-class="{{classPrefix}}__grid-item"
|
class="{{classPrefix}}__square"
|
wx:for="{{gridThemeItems[0]}}"
|
wx:key="index"
|
bind:tap="onSelect"
|
data-index="{{index}}"
|
icon="{{ { name: item.icon, color: item.color } }}"
|
text="{{item.label}}"
|
image="{{item.image}}"
|
style="--td-grid-item-text-color: {{item.color}}"
|
>
|
</t-grid-item>
|
</t-grid>
|
</block>
|
<block wx:elif="{{gridThemeItems.length > 1}}">
|
<view class="{{classPrefix}}__swiper-wrap">
|
<swiper style="height: 456rpx" autoplay="{{false}}" current="{{currentSwiperIndex}}" bindchange="onSwiperChange">
|
<swiper-item wx:for="{{gridThemeItems}}" wx:key="index">
|
<t-grid align="center" t-class="{{classPrefix}}__grid {{classPrefix}}__grid--swiper" column="{{count / 2}}">
|
<t-grid-item
|
t-class="{{classPrefix}}__grid-item"
|
class="{{classPrefix}}__square"
|
wx:for="{{item}}"
|
wx:key="index"
|
data-index="{{index}}"
|
bind:tap="onSelect"
|
icon="{{ { name: item.icon, color: item.color } }}"
|
text="{{item.label}}"
|
image="{{item.image}}"
|
style="--td-grid-item-text-color: {{item.color}}"
|
>
|
</t-grid-item>
|
</t-grid>
|
</swiper-item>
|
</swiper>
|
<view class="{{classPrefix}}__nav">
|
<view class="{{classPrefix}}__dots">
|
<view
|
wx:for="{{gridThemeItems.length}}"
|
wx:key="index"
|
class="{{classPrefix}}__dots-item {{index === currentSwiperIndex ? prefix + '-is-active' : ''}}"
|
/>
|
</view>
|
</view>
|
</view>
|
</block>
|
</template>
|