The elementUI input input box monitors the carriage return and causes the page to refresh

Reason: When there is only one el-input input box in the el-form form, pressing Enter in the input box will trigger the submission event of the form.
Solution: Add @submit.native.prevent property to el-form to prevent the carriage return submission event

 <!-- 搜索 -->
    <search-box>
      <template #form>
        <el-form ref="queryForm" :inline="true" @submit.native.prevent>
          <el-form-item label="">
            <el-input  type="text"  v-model="params.keyWord" clearable @keyup.enter.native="search"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="search">查询</el-button>
          </el-form-item>
        </el-form>
      </template>
      <template #btns>
        <el-button type="warning" icon="el-icon-plus"  @click.native="add">新增</el-button>
      </template>
    </search-box>

Guess you like

Origin blog.csdn.net/weixin_44714325/article/details/109067048
Recommended