报错Cannot read properties of undefined (reading 'clearFiles') TypeError: Cannot read properties of undefined (reading 'clearFiles')
报错 "Cannot read properties of undefined (reading 'clearFiles')" 表明 this.$refs['upload']
是未定义的。这通常表示在 $refs
对象中没有名为 'upload' 的引用。
解决方法:
在出错的语句“this.$refs['upload'].clearFiles()”外加上
this.$nextTick(() =>{
})
效果如下