Browse Source

fix 作品图片空的问题“

lushuncheng 5 years ago
parent
commit
94be0dac2d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      components/multi-uploader.vue

+ 5 - 1
components/multi-uploader.vue

@@ -69,7 +69,11 @@ export default {
       console.log("before", this.$refs.multiUploader);
       let fileType = file.type ? file.type : (file.raw ? file.raw.type : "");
       if (fileType !== "image/png" && fileType !== "image/jpg" && fileType !== "image/jpeg" && fileType !== "image/gif") {
-        this.$message.error("文件类型不正确");
+        this.$message.error("请上传png,jpg格式的图片");
+        return false;
+      }
+      if (file.size / 1024 / 1024 > 2) {
+        this.$message.error("图片大小超过2M");
         return false;
       }
       return true;