<template>
  <span :class="'vc-show-date '+size">
    <span v-if="value !== undefined && value !== null">
      {{ typeof value.format === 'function' ? value.format() : '不是日期类型' }}
    </span>
    <span v-else class="text-secondary"><i>{{ nullText }}</i></span>
  </span>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: "ShowDateOrNull",
  props: {
    nullText: {
      default: '暂无',
      type: String
    },
    size: {
      default: '',
      type: String
    },
    value: {
      type: Object as import('vue').PropType<Date>,
      default: null,
    }
  },
});
</script>