using the iview framework, I want to implement a click of a button to trigger the automatic focus function of Input. The key code is as follows:
render: (h, params) => {
if(params.index == this.editIndex){ //Input
return h("Input", {
props: {
value: params.row.name,
autofocus: true // iview Input
},
on: {
"on-focus": (e) => { //input
this.editIndexText = params.row.name
e.srcElement.select();
},
"on-blur": (e) => { //index
this.editIndex = -1;
console.log(e)
},
"on-keyup": (e) => {
console.log(e)
if(e.code == "Enter"){
this.editIndex = -1;
}
}
}
}, params.row.name)
}else{ //
return h("p", params.row.name)
}
when you click modify, render renders the Input component and automatically gets the focus, but the effect is only displayed for the first time.
the reason is why, is there a solution? I"ve been studying it for a long time. Ask the Great God to tell.