mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
fix(form):fix the problem that the default behavior of enter keyboard operation when the input tag is under the form tag will cause the adjacent button to be triggered
This commit is contained in:
parent
3e65db0847
commit
9034c1781e
@ -4,7 +4,8 @@
|
||||
:class="{
|
||||
'n-form--inline': inline
|
||||
}"
|
||||
@submit="onSubmit"
|
||||
@submit.prevent="onSubmit"
|
||||
@keydown.enter.prevent="handleEnterKeyDown"
|
||||
>
|
||||
<slot />
|
||||
</form>
|
||||
@ -113,6 +114,11 @@ export default {
|
||||
formItemInstance.clearValidationEffect()
|
||||
}
|
||||
}
|
||||
},
|
||||
handleEnterKeyDown (e) {
|
||||
if (e.target.tagName === 'INPUT') {
|
||||
this.onSubmit(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user