Elementui built-in upload component method to obtain dom node index

simply record

If the dom element traversed through a set of data uses the upload component,

It is almost impossible to modify and delete the component through the hook that comes with the component

Because the component's built-in hook cannot obtain the index of the current operation dom, it cannot confirm the operation object

Therefore, when calling the hook function, return the newly added parameters and the original parameters as a new function

For example, when calling the on-success hook,

 :on-success=" handleSuccess(res,file,fileList)"

The hook itself only has three parameters: response and file/filelist, so we can rewrite the following

 :on-success="(res,file,fileList)=>{return handleSuccess(res,file,fileList,index)}"

In this way, the index or other parameters corresponding to the dom can be obtained

Reference link: click here

Guess you like

Origin blog.csdn.net/shinjie1210/article/details/119573742