vue+element 键盘回车事件导致页面刷新的问题

问题:部分输入框输入内容后回车就会刷新页面
方法一:el-from 加上 @submit.native.prevent
element官网文档
W3C 标准中有如下规定:

When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form.

即:当一个 form 元素中只有一个输入框时,在该输入框中按下回车应提交该表单。如果希望阻止这一默认行为,可以在 标签上添加 @submit.native.prevent

方法二:给这个input加enter事件
@keyup.native.enter="SaveBtn"

你可能感兴趣的:(vue+element 键盘回车事件导致页面刷新的问题)