feat: use withDefaults for DatepickerInline
This commit is contained in:
parent
d02c349231
commit
df6a9b67fd
@ -71,7 +71,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed, onBeforeUnmount, onMounted, type PropType, ref, toRef, watch} from 'vue'
|
import {computed, onBeforeUnmount, onMounted, ref, toRef, watch} from 'vue'
|
||||||
import flatPickr from 'vue-flatpickr-component'
|
import flatPickr from 'vue-flatpickr-component'
|
||||||
import 'flatpickr/dist/flatpickr.css'
|
import 'flatpickr/dist/flatpickr.css'
|
||||||
|
|
||||||
@ -84,15 +84,15 @@ import {createDateFromString} from '@/helpers/time/createDateFromString'
|
|||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
import {getFlatpickrLanguage} from '@/helpers/flatpickrLanguage'
|
import {getFlatpickrLanguage} from '@/helpers/flatpickrLanguage'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = withDefaults(defineProps<{
|
||||||
modelValue: {
|
modelValue: Date | null | string
|
||||||
type: [Date, null, String] as PropType<Date | null | string>,
|
}>(), {
|
||||||
validator: prop => prop instanceof Date || prop === null || typeof prop === 'string',
|
modelValue: null,
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'close-on-change'])
|
const emit = defineEmits<{
|
||||||
|
'update:modelValue': [Date | null],
|
||||||
|
}>()
|
||||||
|
|
||||||
const {t} = useI18n({useScope: 'global'})
|
const {t} = useI18n({useScope: 'global'})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user