diff --git a/src/components/Form/src/Form.vue b/src/components/Form/src/Form.vue index 1a9076d65..33db690db 100644 --- a/src/components/Form/src/Form.vue +++ b/src/components/Form/src/Form.vue @@ -55,7 +55,7 @@ export default defineComponent({ vLoading: propTypes.bool.def(false), labelPosition: propTypes.string.def('left'), }, - emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onBlur','onFocus','onEnter','hiddenFilterButton','changeDialogWidth','onInput'], + emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onSubmit', 'onBlur','onFocus','onEnter','hiddenFilterButton','changeDialogWidth','onInput'], setup(props, { slots, expose, emit }) { // element form 实例 const elFormRef = ref>() @@ -196,6 +196,10 @@ export default defineComponent({ const onChange = (field, cur) => { emit('onChange', field, cur) } + const onSubmit = (event) => { + emit('onSubmit', event) + } + /** * 监听失去焦点 * @param field 当前操作字段 @@ -461,6 +465,7 @@ export default defineComponent({ class={prefixCls} v-loading={props.vLoading} label-position={props.labelPosition} + onSubmit={(e)=>{onSubmit(e)}} > {{ // 如果需要自定义,就什么都不渲染,而是提供默认插槽 diff --git a/src/components/Search/src/Search.vue b/src/components/Search/src/Search.vue index f75d6fa2f..deea2f7a7 100644 --- a/src/components/Search/src/Search.vue +++ b/src/components/Search/src/Search.vue @@ -122,7 +122,12 @@ const onInput = (field,value) => { const onChange = (field, value)=>{ emit('onChange', field,value) } + +const onSubmit = (e) => { + e.preventDefault(); +} const onEnter = async (field, value, e) => { + if(props.enterSearch){ search() }else{ @@ -183,6 +188,7 @@ const opensearchTable = ( return } } + }else if(searchCondition[i].isTableRowValue){ if(searchCondition[i].required){ if (row[searchCondition[i].value] == '' ||row[searchCondition[i].value] == undefined) { @@ -305,6 +311,7 @@ defineExpose({setFormValues,search}) // 提供 open 方法,用于打开弹窗 @opensearchTable="opensearchTable" @onChange="onChange" @onEnter="onEnter" + @onSubmit="onSubmit" >