<template>
  <div class="md:w-screen-xl m-auto relative sm:flex" v-infinite-scroll="load">
    <el-row :gutter="24" class="flex">
      <template v-for="(item,index) in list" :key="index">
        <el-col :span="24" class="mb-5 min-w-xs">
          <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`https://websoft.top/market/detail`,item,item.articleId)">
            <div class="flex">
              <el-image :src="item.appIcon" fit="fill" :lazy="true" class="w-[150px] h-[150px] cursor-pointer" />
              <div class="flex-1 px-4 py-5 sm:p-6 !p-4">
                <p class="text-gray-700 dark:text-white text-base font-semibold  flex items-center gap-1.5">
                  <span class="flex-1 text-xl cursor-pointer">{{ item.appName }}</span>
                </p>
                <p class="flex flex-col gap-1.5 py-2 text-gray-500 justify-between">
                  <span class="text-red-500">￥{{ item.price }} </span>
                  <span class="text-gray-500">{{ item.comments }} </span>
                </p>
                <div class="button-group flex mt-3">
                  <el-button class="">演示</el-button>
                  <el-button class="">购买</el-button>
                </div>
            </div>

            </div>
          </el-card>
        </el-col>
      </template>
    </el-row>
  </div>
  <div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs">
    没有更多了
  </div>
</template>

<script setup lang="ts">
import {openSpmUrl} from "~/utils/common";
import dayjs from "dayjs";

const props = withDefaults(
    defineProps<{
      list?: any[];
      disabled?: boolean;
    }>(),
    {}
);

const emit = defineEmits<{
  (e: 'done'): void;
}>();

const load = () => {
  if(!props.disabled){
    emit('done')
  }
}
</script>
