feat: ele 新增 RangePicker 和 getRangePickerDefaultProps 适配

This commit is contained in:
puhui999
2025-05-13 10:55:58 +08:00
parent a5df250b04
commit 2baf398c7f
3 changed files with 81 additions and 43 deletions

View File

@@ -176,6 +176,7 @@ export type ComponentType =
| 'Input'
| 'InputNumber'
| 'RadioGroup'
| 'RangePicker'
| 'RichTextarea'
| 'Select'
| 'Space'
@@ -299,6 +300,26 @@ async function initComponentAdapter() {
slots,
);
},
RangePicker: (props, { attrs, slots }) => {
const { name, id } = props;
const extraProps: Recordable<any> = {};
if (name && !Array.isArray(name)) {
extraProps.name = [name, `${name}_end`];
}
if (id && !Array.isArray(id)) {
extraProps.id = [id, `${id}_end`];
}
return h(
ElDatePicker,
{
...props,
type: 'datetimerange',
...attrs,
...extraProps,
},
slots,
);
},
DatePicker: (props, { attrs, slots }) => {
const { name, id, type } = props;
const extraProps: Recordable<any> = {};