1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| <template>
| <span class="cl-date-text">{{ value }}</span>
| </template>
|
| <script lang="ts" setup>
| defineOptions({
| name: 'cl-date-text'
| });
|
| import { computed } from 'vue';
| import dayjs from 'dayjs';
|
| const props = defineProps({
| modelValue: [String, Number],
| format: {
| type: String,
| default: 'YYYY-MM-DD HH:mm:ss'
| }
| });
|
| const value = computed(() => {
| return props.modelValue ? dayjs(props.modelValue).format(props.format) : '';
| });
| </script>
|
|