<script setup lang="ts">
const props = defineProps({
  idCodeList: {
    type: Array,
    default: () => []
  }
})
</script>

<template>
  <el-popover
      title="已关联的追溯码产品标识码："
      placement="bottom-start"
      trigger="hover"
      width="250px"
  >
    <template #reference>
      <div class="id-code-panel">
        <div class="code" v-if="props.idCodeList.length >0">{{props.idCodeList[0]}}</div>
        <div class="number" v-if="props.idCodeList.length >1">
          +{{props.idCodeList.length-1}}
        </div>

      </div>
    </template>
    <template #default>
      <div class="id-code-detail">
        <div class="item" v-for="(item,index) in props.idCodeList" :key="index">
          {{index+1}}.{{item}}

        </div>
      </div>
    </template>
  </el-popover>

</template>

<style scoped lang="scss">
.id-code-panel{
  display: flex;
  .number{
    margin-left: 10px;
    color: green;
  }

}
</style>