美文网首页
vue表单输入框回车刷新页面

vue表单输入框回车刷新页面

作者: 赵羽珩 | 来源:发表于2020-04-23 21:01 被阅读0次
<!-- 搜索框 -->
<el-form ref="searchFormRef" :model="searchForm" @submit.native.prevent>
    <el-input ref="searchInputRef" v-model="searchForm.search" placeholder="请输入关键词进行检索" @keyup.enter.native="axios_query()">
        <el-button @click="axios_query()" slot="append" icon="el-icon-search"></el-button>
    </el-input>
</el-form>

el-input添加回车事件@keyup.enter.native,会刷新页面。无法传递参数,并获取数据。需要在el-form标签添加@submit.native.prevent

相关文章

网友评论

      本文标题:vue表单输入框回车刷新页面

      本文链接:https://www.haomeiwen.com/subject/qbyzihtx.html