|
|
@ -54,7 +54,7 @@ export default defineComponent({ |
|
|
|
vLoading: propTypes.bool.def(false), |
|
|
|
labelPosition: propTypes.string.def('left'), |
|
|
|
}, |
|
|
|
emits: ['register','opensearchTable', 'onChange'], |
|
|
|
emits: ['register','opensearchTable', 'onChange', 'onBlur'], |
|
|
|
setup(props, { slots, expose, emit }) { |
|
|
|
// element form 实例 |
|
|
|
const elFormRef = ref<ComponentRef<typeof ElForm>>() |
|
|
@ -188,6 +188,14 @@ export default defineComponent({ |
|
|
|
const onChange = (field, cur) => { |
|
|
|
emit('onChange', field, cur) |
|
|
|
} |
|
|
|
/** |
|
|
|
* 监听失去焦点 |
|
|
|
* @param field 当前操作字段 |
|
|
|
* @param e 改变后值 |
|
|
|
*/ |
|
|
|
const onBlur = (field, e) => { |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
// 渲染formItem |
|
|
|
const renderFormItem = (item: FormSchema) => { |
|
|
|
// 单独给只有options属性的组件做判断 |
|
|
@ -291,6 +299,7 @@ export default defineComponent({ |
|
|
|
{...setComponentProps(item)} |
|
|
|
style={item.componentProps?.style} |
|
|
|
onChange={(e)=>{onChange(item.field, e)}} |
|
|
|
onBlur={(e)=>{onBlur(item.field, e)}} |
|
|
|
{...(notRenderOptions.includes(item?.component as string) && |
|
|
|
item?.componentProps?.options |
|
|
|
? { options: item?.componentProps?.options || [] } |
|
|
|