我是靠谱客的博主 老迟到路灯,这篇文章主要介绍element-ui中el-upload报错 Uncaught TypeError: Cannot set property ‘status‘ of null,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<el-upload class="avatar-uploader" :class="!isEdit ? 'read-file' : 'editFile'" :action="'api/file/upload?_allow_anonymous=true'" :on-preview="handlePreview" :on-remove="handleRemove" :on-success="uploadSuccess" :on-error="uploadError" multiple :limit="limitNumber" :on-exceed="handleExceed" :before-upload="beforeAvatarUpload" :file-list="fileList" > </el-upload>

在使用el-upload中,上传多个文件报错 Uncaught TypeError: Cannot set property 'status' of null

情况多发生为手动修改了 fileList的值。

解决方案:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
beforeAvatarUpload(file) { // 判断文件类型 const isJPG = file.type === "image/jpeg" || file.type === "image/png"; if (!isJPG) { this.$message.error("仅支持图片!上传其他附件,请通过PC端操作!"); return isJPG; } // 手动修改fileList的值,需要在befoupload中添加 if (!this.fileList) { this.fileList = []; } this.fileList.push(file); this.defaultAttachment.attachFile = this.fileList; },

最后

以上就是老迟到路灯最近收集整理的关于element-ui中el-upload报错 Uncaught TypeError: Cannot set property ‘status‘ of null的全部内容,更多相关element-ui中el-upload报错内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(75)

评论列表共有 0 条评论

立即
投稿
返回
顶部