aliyun0758874076 1 år sedan
förälder
incheckning
17186501ce
1 ändrade filer med 7 tillägg och 8 borttagningar
  1. 7 8
      src/components/Tinymce/components/EditorImage.vue

+ 7 - 8
src/components/Tinymce/components/EditorImage.vue

@@ -13,8 +13,7 @@
       <el-upload
         :multiple="true" :file-list="fileList" :show-file-list="true" :on-remove="handleRemove"
         :on-success="handleSuccess" :before-upload="beforeUpload" class="editor-slide-upload" :action="action"
-        :headers="headers" :data="dataObj" list-type="picture-card" :on-change="changeFiles"
-        :drag="true"
+        :headers="headers" :data="dataObj" list-type="picture-card"
       >
         <el-button size="small" type="primary">
           <!-- Click upload -->
@@ -95,6 +94,12 @@ export default {
       }
     },
     beforeUpload(file) {
+      const isLt = file.size / 1024 / 5 >= 1 && file.size / 1024 / 1024 / 5 <= 1
+      if (!isLt) {
+        // this.$refs.upImagesFiles.abort()
+        this.$message.error('上传文件大小不得小于5KB,不得大于5MB!')
+        return false
+      }
       const _self = this
       const _URL = window.URL || window.webkitURL
       const fileName = file.uid
@@ -112,12 +117,6 @@ export default {
         }
         resolve(true)
       })
-    },
-    changeFiles(file, fileList) {
-      // let fileName = file.name;
-      // let uid = file.uid
-      console.log(file)
-      console.log(fileList)
     }
   }
 }