<!--pages/community/index.wxml-->
<view>
  <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
    <t-tab-panel label="推荐" value="0" />
    <t-tab-panel label="最新" value="1" />
    <t-tab-panel label="我的" value="2" />
  </t-tabs>

  <view class="padding">
    <view wx:for="{{list}}" class="padding row mb-32" data-id="{{item.id}}" bind:tap="goInfo">
      <view class="flex flex-center flex-justify-start">
        <image src="https://res.catter.cn/pub/2025/09/30/20250930143142508.png" class="avatar"></image>
        <view class="ml-16">
          <view class="bold">第五季</view>
          <view class="font-12 grey">23 小时前</view>
        </view>
      </view>
      <view class="mt-16">
        <view>{{item.content}}</view>
      </view>
      <view class="mt-16">
        <view wx:if="{{item.imgList.length == 1}}">
          <view wx:for="{{item.imgList}}">
            <image src="{{item.url}}" style="border-radius: 16rpx; height: 50vw; width: 100%;" mode="aspectFill"></image>
          </view>
        </view>
        <view wx:else class="grid" >
            <view class="item" wx:for="{{item.imgList}}">
              <view>
                <image src="{{item.url}}" style="width: 100%;height: 30vw; border-radius: 16rpx;" mode="aspectFill" b></image>
              </view>
            </view>
          </view>
      </view>
      <view class="mt-32 flex flex-center flex-justify-end">
        <view class="flex flex-center" data-item="{{item}}" bind:tap="like">
          <t-icon name="{{item.hasLiked === 1 ?'thumb-up-filled':'thumb-up'}}" style="color: {{item.hasLiked === 1 ?'red':''}};" ></t-icon>
          <view class="ml-16">{{item.likeCount}}</view>
        </view>
        <view class="flex flex-center ml-32">
          <t-icon name="chat-bubble-smile"></t-icon>
          <view class="ml-16">{{item.commentCount}}</view>
        </view>
      </view>
    </view>
  </view>

  <t-fab icon="camera" bind:click="goAdd" aria-label="增加"></t-fab>
</view>