<script setup lang="ts">
import dayjs from 'dayjs'

withDefaults(
  defineProps<{
    type: 'Original' | 'Date' | 'Avatar' | 'Select'
    value?: number | string | Date
    customClass?: string
    options?: { label: string; value: string | number }[]
  }>(),
  { type: 'Original', value: '' },
)
</script>
<template>
  <div>
    <span v-if="type === 'Original'">{{ value }}</span>
    <span v-if="type === 'Date'">{{ value && dayjs(value).format('YYYY-MM-DD') }}</span>
    <wd-img v-if="type === 'Avatar'" width="40" height="40" round :src="String(value)" class="" />
    <span v-if="type === 'Select'">{{ options?.find((it) => it.value === value)?.label }}</span>
  </div>
</template>
