<!-- 分类展示：second-one 风格  -->
<template>
  <view v-for="item in props.data" :key="item.id">
    <!-- 一级分类的名字 -->
    <!-- <view class="title-box ss-flex ss-col-center ss-row-center ss-p-b-30">
      <view class="title-line-left" />
      <view class="title-text ss-p-x-20">{{ item.name }}</view>
      <view class="title-line-right" />
    </view> -->
    <titleCom :title="item.name" />
    <!-- 二级分类的名字 -->
    <view class="goods-item-box ss-flex ss-flex-wrap ss-p-b-20">
      <view class="goods-item" v-for="item in item.children" :key="item.id" @tap="
        sheep.$router.go('/pages/goods/list', {
          categoryId: item.id,
          type: props.activeMenu,
        })
        ">
        <image class="goods-img" :src="item.picUrl" mode="aspectFill" />
        <view class="ss-p-10">
          <view class="goods-title ss-line-1">{{ item.name }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import sheep from '@/sheep';
import titleCom from '@/pages/index/com/title.vue'
const props = defineProps({
  data: {
    type: Object,
    default: () => ({}),
  },
  activeMenu: [Number, String],
});
</script>

<style lang="scss" scoped>
.title-box {

  .title-line-left,
  .title-line-right {
    width: 15px;
    height: 1px;
    background: #d2d2d2;
  }
}

.goods-item-box {
  padding: 10px;
}

.goods-item {
  width: calc((100% - 20px) / 3);
  margin-right: 8px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: 0px 0px 20rpx 8rpx rgba(199, 199, 199, 0.22);
  border-radius: 20rpx;
  padding: 16rpx 10px;
  display: flex;
  align-items: center;
  justify-content: center;

  &:nth-of-type(3n) {
    margin-right: 0;
  }

  .goods-img {
    // width: calc((100vw - 180px) / 3);
    // height: calc((100vw - 180px) / 3);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 20rpx;

  }

  .goods-title {
    font-size: 28rpx;
    // font-weight: bold;
    color: #333333;
    line-height: 40rpx;
    text-align: center;
  }

  .goods-price {
    color: $red;
    line-height: 40rpx;
  }
}
</style>
