el-table新增记录,通过id获行记录的控件焦点
<el-table :data="formData.list" ref="tabRef" class="my-table" >
<el-table-column label="编码" align="center" min-width="150" class="custom-form-item">
<template #default="scope">
<el-form-item :prop="'list[' + scope.$index + '].code'" >
<el-input v-model="scope.row.code" placeholder="编码为必填"
maxlength="32" minlength="8"
:id="'input_'+scope.$index" clearable></el-input>
</el-form-item>
</template>
</el-table-column>
</el-table>
const { createApp, nextTick} = Vue
//直接引用nextTick ,不需要this.$nextTick
//nextTick,获取更新后的 DOM
nextTick(() => {
indexTemp=formData.value.list.length-1;
ids="input_"+indexTemp.toString();
console.log("ids "+ids);
console.log("indexTemp "+indexTemp);
console.log(ids+"...."+$('#'+ids));
$('#'+ids).focus();
});