设置动态ref ---- :ref=字符串直接+变量的形式赋值
<template v-for="(item, i) in stepList" :key="i">
<h-b-upload
:ref="'uploadRef' + i"
accept="image/*"
:draggable="false"
:multiple="true"
:show-upload-list="false"
:fileList="fileList"
filePath="/capp/"
@change="file => changeFile(file, i)"
></h-b-upload>
</template >
setup中获取动态ref ---- instance.refs['uploadRef' + index][0]
const instance = getCurrentInstance();
instance.refs['uploadRef' + index][0]
网友评论