"vue": "^2.5.2",
"element-ui": "^2.2.1",
<el-upload
action="http://mt.cn:3355/backend/config/uploadImg"
list-type="picture-card"
:file-list="themePictures"
:data="themeData"
:on-success="themeSuccess"
:on-remove.self="removeTheme"
:on-error="uploadError"
:before-upload="beforeUpload">
<i class="el-icon-plus"></i>
</el-upload>
removeTheme(file, fileList) {
req_removeTheme({id:file.id}).then(res => {
this.$message.success('删除成功')
})
},
beforeUpload(file) {
const isMatch = file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png' || file.type === 'image/gif' || file.type === 'image/bmp'
const isLt2M = file.size / 1024 / 1024 < 1
if (!isMatch) {
this.$message.error('图片格式不匹配')
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 1MB!')
}
return isMatch && isLt2M
},
好像新的才会出现这个问题,试了下可以通过file.status的状态来区分
`handleRemove(file, fileList) {
}`