学无先后,达者为师

网站首页 编程语言 正文

element ui table 内嵌 input 调用 focus 方法无效

作者:qq_42431718 更新时间: 2022-02-11 编程语言

element ui table 内嵌 input 调用 focus 方法无效

<el-table>
  <el-table-column label="名称">
    <template>
      <el-input ref="inputRef" />
    </template>
  </el-table-column>
</el-table>

// 无效
this.$refs['inputRef'].focus()
this.$refs['inputRef'][0].focus()
this.$refs['inputRef'].$el.children[0].focus()

// 有效
<el-input id="inputRef" />
document.getElementById('inputRef').focus()

原文链接:https://blog.csdn.net/qq_42431718/article/details/120697533

栏目分类
最近更新