<template>
  <div class="card_list">
    <div v-for="(e,i) in props.list" :key="'card' + i" class="item" style="width: calc((100% - 32px) / 3)">
      <ability-card v-if="e.id" :item="e" @change_check="changeCheck" :flag="props.flag" @deleteItem="deleteItem" @move="move"/>
      <div v-else class="empty_card" @click="open">
        <span>+</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import abilityCard from "./ability-card.vue"
const props = defineProps({
  list: {
    type: Array,
    default: []
  },
  flag: {
    type: Boolean,
    default: false
  }
})
const emit = defineEmits(["changeCheck","openBox","deleteItem","move"])
const changeCheck = (item) => {
  emit("changeCheck",item)
}
const open = () => {
  console.log(3333)
  emit("openBox")
}
const deleteItem = (item) => {
  emit("deleteItem",item)
}
const move = (temp) => {
  emit("move",temp)
}
</script>

<style lang="scss" scoped>
.card_list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  // .item {
  //   width: calc(100% - 32px);
  // }
  .empty_card {
    cursor: pointer;
    width: 384px;
    height: 242px;
    border: 1px dashed #dadee7;
    border-radius: 4px;
    margin-bottom: 24px;
    color: #dadee7;
    text-align: center;
    line-height: 242px;
    font-size: 48px;
    font-weight: 100;
  }
}
</style>