From 9034c1781e17c40109d984e8f478b63692807308 Mon Sep 17 00:00:00 2001 From: "songwanli2025@163.com" Date: Fri, 5 Jun 2020 18:15:21 +0800 Subject: [PATCH] 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 --- src/Form/src/Form.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Form/src/Form.vue b/src/Form/src/Form.vue index e4c9a4d0b..625578fd4 100644 --- a/src/Form/src/Form.vue +++ b/src/Form/src/Form.vue @@ -4,7 +4,8 @@ :class="{ 'n-form--inline': inline }" - @submit="onSubmit" + @submit.prevent="onSubmit" + @keydown.enter.prevent="handleEnterKeyDown" > @@ -113,6 +114,11 @@ export default { formItemInstance.clearValidationEffect() } } + }, + handleEnterKeyDown (e) { + if (e.target.tagName === 'INPUT') { + this.onSubmit(e) + } } } }