<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent> <el-form-item label="表单名" prop="name"> <el-input v-model="queryParams.name" placeholder="" clearable @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-form> 解决方案: 解决方案1.可以在el-form 中添加 @submit.native.prevent 字段 进行防止在使用@keyup.enter.native="handleQuery" 的时候回车刷新了页面的问题 解决方案2: 还以复制一份<el-form-item> 标签,然后给不需要的<el-form-item> 标签进行添加v-show="false" ,此时不需要在el-form 中添加 @submit.native.prevent 字段
标签:prevent,form,submit,表单,输入框,handleQuery,回车,native From: https://www.cnblogs.com/rockyjs/p/17310793.html