|  |  |  | 
|---|
|  |  |  | type Props = { | 
|---|
|  |  |  | modelValue: string | number; | 
|---|
|  |  |  | minDate?: Date; | 
|---|
|  |  |  | maxDate?: Date; | 
|---|
|  |  |  | type?: string; | 
|---|
|  |  |  | format?: string; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const props = withDefaults(defineProps<Props>(), {}); | 
|---|
|  |  |  | const props = withDefaults(defineProps<Props>(), { | 
|---|
|  |  |  | format: 'YYYY-MM-DD', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const emit = defineEmits<{ | 
|---|
|  |  |  | (e: 'update:modelValue', val: string | number): void; | 
|---|
|  |  |  | }>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleOpen() { | 
|---|
|  |  |  | const _modelValue = [props.modelValue]; | 
|---|
|  |  |  | const _modelValue = dayjs(props.modelValue).toDate(); | 
|---|
|  |  |  | Portal.add((key) => { | 
|---|
|  |  |  | return h( | 
|---|
|  |  |  | Portal.Container, | 
|---|
|  |  |  | 
|---|
|  |  |  | h(DatePicker, { | 
|---|
|  |  |  | modelValue: _modelValue, | 
|---|
|  |  |  | onCancel: onClose, | 
|---|
|  |  |  | type: props.type, | 
|---|
|  |  |  | maxDate: props.maxDate, | 
|---|
|  |  |  | onConfirm: ({ selectedValue }) => { | 
|---|
|  |  |  | emit('update:modelValue', dayjs(selectedValue.join('-')).format('YYYY-MM-DD')); | 
|---|
|  |  |  | emit('update:modelValue', dayjs(selectedValue.join('-')).format(props.format)); | 
|---|
|  |  |  | onClose(); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | minDate: props.minDate, | 
|---|