wupengfei
2 天以前 c2463c02a17f92df55ec77ed2da3fb724290c072
packages/components/src/Input/ChooseInputWithDatePicker.vue
@@ -18,16 +18,20 @@
  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;
  (e: 'change'): void;
}>();
function handleOpen() {
  const _modelValue = [props.modelValue];
  const _modelValue = dayjs(props.modelValue).toDate();
  Portal.add((key) => {
    return h(
      Portal.Container,
@@ -49,9 +53,12 @@
                  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();
                  },
                  onChange: () => {
                    emit('change');
                  },
                  minDate: props.minDate,
                }),
            }