您的位置:首页 > Web前端 > Vue.js

element+vue表单点击回车路由刷新

2019-01-21 16:35 1516 查看

项目场景:element+vue    后台管理系统


今天使用elementUI的表单添加数据出现,点击回车键,页面自动刷新,并且在原路由里面加了一个?,解决办法如下:

<el-form  :inline="true" @submit.native.prevent>
</el-form>
el-from 加上 @submit.native.prevent
具体是参考element-ui文档解决的

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。

原文:https://blog.csdn.net/qq_32340877/article/details/80272155 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: