Commit 22635c00 authored by 刘怀志's avatar 刘怀志

66418 基础配置-上传 非图片格式上传完成后 无法在上传了

parent 6a0bcd1d
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
ref="imageUpload" ref="imageUpload"
multiple multiple
action action
:accept="['.jpg', '.png', 'jpeg']" :accept="'.jpg,.png,jpeg'"
list-type="picture-card" list-type="picture-card"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
...@@ -177,12 +177,14 @@ export default { ...@@ -177,12 +177,14 @@ export default {
const suffix = img === 'jpg' || img === 'png' || img === 'jpeg' const suffix = img === 'jpg' || img === 'png' || img === 'jpeg'
if (!suffix) { if (!suffix) {
this.$message.error('文件格式不正确, 请上传png/jpg/jpeg图片格式文件') this.$message.error('文件格式不正确, 请上传png/jpg/jpeg图片格式文件')
this.$refs.imageUpload.clearFiles()
return false return false
} }
if (this.fileSize) { if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) { if (!isLt) {
this.$modal.msgError(`上传图片大小不能超过 ${this.fileSize} MB`) this.$modal.msgError(`上传图片大小不能超过 ${this.fileSize} MB`)
this.$refs.imageUpload.clearFiles()
return false return false
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment