<template>
  <div
    class="
      collection_card
      flex
      text-font-white
      px-4
      py-6
      rounded-md
      shadow-sm
      bg-font-light-black
    "
  >
    <!-- <div v-if="colletionData.category == '图片'" class="imgbox left w-4/12 rounded-md h-40">
      <img :src="colletionData.cover?colletionData.cover:colletionData.fileUrl" class="rounded-md max-h-full max-w-full" />
    </div> -->
    <div class="imgbox left w-4/12 rounded-md h-40">
      <img :src="colletionData.cover?colletionData.cover:'/img/cover.png'" class="rounded-md max-h-full max-w-full" />
    </div>

    <div class="right w-8/12">
      <div class="w-full px-4">
        <div class=" text-sm">{{colletionData.name}}</div>

        <div class="mt-8">
          <div class="text-font-dark-blue text-xs">NFT编号</div>
            <p class=" break-words line-clamp-2   w-full text-xs ">
            {{colletionData.nftId}}
            </p>
        </div>
        <div class="flex flex-wrap w-full text-xs mt-3" v-if="colletionData.isCommemorate == 0">
          <div class="text-font-dark-blue">题材</div>
          <div class="flex-1 pl-3 flex gap-x-2" v-for='(i,index) in getThemeList' :key="index">
            <span>{{i}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import Vue, { PropType } from "vue";
import {MyNFTItem} from '@/types/Dto'
export default Vue.extend({
  name: "CollectionCard",
  props: {
      colletionData:{} as PropType<MyNFTItem>
  },
  mounted(){
    console.log(this.colletionData)
  },
  computed:{
    getThemeList():string | string[]{
        if(this.colletionData.theme){
            return  this.colletionData.theme.split(',')
        }
        return []

    }
  }
});
</script>
<style scoped lang="less">
.imgbox {
  display: flex;
  align-items: center;
  max-height: 140px;
  img {
    max-height: 100%;
    max-width: 100%;
    margin: 0 auto;
  }
}
</style>
