<!-- 搜索 -->
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="名称" prop="nameLike">
<el-input v-model="queryParams.nameLike" placeholder="请输入商品名称" @keyup.enter.native="SearchFn"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="SearchFn" plain>搜索</el-button>
<el-button icon="el-icon-refresh" @click="RefreshFn">重置</el-button>
</el-form-item>
</el-form>
- 回车搜索的时候,刷新整个页面
解决
在 el-form
上添加 @submit.native.prevent
完整
<el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
<el-form-item label="名称" prop="nameLike">
<el-input v-model="queryParams.nameLike" placeholder="请输入商品名称" @keyup.enter.native="SearchFn"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="SearchFn" plain>搜索</el-button>
<el-button icon="el-icon-refresh" @click="RefreshFn">重置</el-button>
</el-form-item>
</el-form>