zhangxc 5 سال پیش
والد
کامیت
b4e2393421
1فایلهای تغییر یافته به همراه18 افزوده شده و 2 حذف شده
  1. 18 2
      src/components/icss/AddMedicinePrompt.vue

+ 18 - 2
src/components/icss/AddMedicinePrompt.vue

@@ -55,6 +55,7 @@
                           :limit="1"
                           :on-preview="handlePreview"
                           :on-remove="handleRemove"
+                          :before-upload="handleBeforeUpLoad"
                           :before-remove="beforeRemove"
                           :on-change="handleChange"	
                           :on-success="handleSuccess"
@@ -134,6 +135,7 @@
         showUpLoad:true,
         showFileList: false,
         upload: false,
+        showConfirm: true,
       }
     },
     /*watch:{
@@ -400,11 +402,25 @@
          this.showUpLoad = true
             this.form.fileList=[]
       },
+      handleBeforeUpLoad(file){
+        console.log('aaaaaaaaaa',file);
+        if(file.size/1024/1024 >= 500){
+           this.warning('文件上传失败,超出大小限制500MB')
+           this.form.fileList=[]
+           this.showConfirm = false
+           return false
+        }else{
+          this.showConfirm = true
+        }
+      },
       handlePreview(file) {
-        console.log(file);
+
       },
       beforeRemove(file, fileList) {
-        return this.$confirm(`确定移除 ${ file.name }?`);
+        if(this.showConfirm ){
+           return this.$confirm(`确定移除 ${ file.name }?`);
+        }
+       
       }
     }
   }