elementUI表格中的输入框触发事件后下一条数据的输入框获得焦点

image.png
如图,表格中的红色输入框触发事件(这里用的是回车事件)时,绿色输入框获得焦点。

<el-table-column

 :show-overflow-tooltip="true"

 :label="$t(&quot;table.registerInOut.tag&quot;)"

 prop="tag"

 align="center"

 width="180px"

 >

 <template slot-scope="scope">

 <el-input

 :disabled="scope.row.disabled"

 placeholder="扫描或输入编号"

 v-model="scope.row.tag"

 @keyup.enter.native="addAnswer(scope.row)"

 auto-complete="off"

 />

 </template>

 </el-table-column>
阅读 2.1k
1 个回答

this.$refs[index].onEnter = () => {

this.$refs[index+1].focus()

}

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题