<template>
  <div class="checkbox" :class="{ checked: modelValue }" @click="toggle">
    <img src="@/assets/icon/asset/duihao.png" v-if="modelValue" alt="" />
  </div>
</template>

<script setup>
  const props = defineProps({
    modelValue: { type: Boolean, default: false },
  });

  const emits = defineEmits(["update:modelValue"]);

  const toggle = () => {
    emits("update:modelValue", !props.modelValue);
  };
</script>

<style scoped>
  .checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: #df384c; /* 红色背景 */
    cursor: pointer;
    transition: 0.2s;
    user-select: none;
  }

  .checkbox.checked {
    background: #df384c; /* 选中仍为红色背景 */
  }

  img {
    width: 10px;
    height: 7px;
  }
</style>
