<!--
 * @Author: ChenChanghua
 * @Date: 2023-03-08 14:52:17
 * @Description: file content
-->
<script setup>
import { ref } from "vue";

const props = defineProps({
  data: Object,
  onAction: Object,
});

const focused = ref(false);

// 注册回调
const onFocus = () => {
  focused.value = true;
};
const onBlur = () => {
  focused.value = false;
};
const onClick = () => {
  props.data.onClick();
};
props.onAction.register("onFocus", onFocus);
props.onAction.register("onBlur", onBlur);
props.onAction.register("onClick", onClick);

</script>

<template>
  <div
    :style="{
      width: 150,
      height: 70,
      fontSize: 20,
      color: focused ? '#FF0000' : '#FFFFFF',
      backgroundColor: '#007788',
    }"
  >
    {{ data.content }}
  </div>
</template>
