[Bug Report] 当搜索栏只有一个form表单中只有一个input框时,使用键盘的enter事件会改变路由地址,会加上一个“问号”
Element UI version
2.13.2
OS/Browsers version
WIN10 / chrome浏览器 版本 80.0.3987.122(正式版本) (64 位)
Vue version
3.0.0-beta.14
Reproduction Link
https://codepen.io/pen/?&editable=true=https%3A%2F%2Felement.eleme.io%2F%3F
Steps to reproduce
https://element.eleme.cn/#/zh-CN/component/form 数字类型验证,在线运行,聚焦到input框后,直接使用键盘的enter即可复现,没有自定义enter事件,却触发了enter事件
What is Expected?
不触发默认的enter事件
What is actually happening?
触发了默认的enter事件
W3C 标准中有如下规定:当一个 form 元素中只有一个输入框时,在该输入框中按下回车应提交该表单。 具体可以看https://element.eleme.cn/?#/zh-CN/component/form
如果想规避默认行为,可以另加一个输入框。
<el-form-item v-show="false">
<el-input />
</el-form-item>
如果有多个输入框,但是希望保留这个 onEnter 效果,应该怎么写
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
参考:https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission