问题:
在<el-form></el-form>
里面只有一个el-input
输入框的情况下,初始加载后点击搜索,会刷新页面。
解决办法:
在<el-form></el-form>
标签中添加 @submit.native.prevent
复制代码
1
2
3
4
5
6
7
8
9
10<el-form ref='tableForm' :model='tableForm' @submit.native.prevent > <el-form-item prop='search'> <el-input ref="searchInput" placeholder='请输入姓名' @keyup.enter.native="searchBtn('tableForm')" v-model='tableForm.midValue'></el-input> </el-form-item> </el-form>
在<el-form></el-form>
里,有多个输入框时,不会出现此情况
另:
如果想实现回车搜索, 在<el-input></el-input>
标签上,要添加 @keyup.enter.native
阻止vue默认事件。
最后
以上就是霸气唇彩最近收集整理的关于element-ui 阻止 表单输入框搜索后自动刷新页面的全部内容,更多相关element-ui内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复