环境:
vue-cli
vue=2.6.10
ElementUI=^2.12.0
使用elmentui上传空间做了一个图片上传功能,代码如下:
`<ul>
<li class="upload-item"
v-for="(item, index) in attachmentFileArr"
:key="index">
<el-button icon="el-icon-error"
class="romove-item"
@click="reomveItem('attachment', index)"
circle></el-button>
<div>
<el-upload action="/api/common/upload_file"
:ref="'ref_attachment_file_' + index"
:auto-upload="false"
:before-upload="beforeUpload"
:on-change="(file, fileList) => {hanldeFileChange(file, fileList, 'attachment', index)}"
:on-remove="(file, fileList) => {hanldeRemovefile(file, fileList, 'attachment', index)}"
:file-list="attachment_file_list[index]"
:on-progress="uploadFileProcess"
:on-success="(res, file) => {handleFileSuccess(res, file, 'attachment', index)}"
list-type="picture"
:limit="1">
<el-button type="primary"
class="btn-upload"
v-show="attachmentUploadBtnShow[index]">仅上传小于25M文件大文件<br />请上传百度云后填写链接
</el-button>
<span slot="tip"
class="tip_note"></span>
</el-upload>
<el-input type="textarea"
:rows="3"
v-model="attachment_desc[index]"
:ref="'ref_attachment_desc' + index"
placeholder="请描述该附件内容与作用"
@input.native="(event) => {saveFileDesc(event, 'attachment', index)}"></el-input>
</div>
</li>
</ul>`
效果如下:
为什么使用_this.$refs['ref_attachment_file_' + rowIndex].clearFiles()
这个方法会报错呢?
查看函数报这个异常
已经尝试关闭严谨模式,但是没用~
求指点
_this.$refs['ref_attachment_file_' + rowIndex][0].clearFiles()