Vue -- element-ui el-input组件 回车刷新页面问题
form内只有一个输入框时,按回车会刷新页面 && 如果input有回车事件回车也会刷新页面
<el-form ref="form" :inline="true" :model="form" label-width="100px">
<el-input v-model="form.keyword" placeholder="筛选关键词" class="handle-input mr10" @keyup.enter.native="search"></el-input>
</el-form>
阻止form的默认事件,即在form上加上这句话:@submit.native.prevent
<el-form ref="form" :inline="true" :model="form" label-width="100px" @submit.native.prevent>
<el-input v-model="form.keyword" placeholder="筛选关键词" class="handle-input mr10" @keyup.enter.native="search"></el-input>
</el-form>