Selaa lähdekoodia

make upload creat url for all file (#1530)

baiyaaaaa 8 vuotta sitten
vanhempi
commit
78a460ac9e
1 muutettua tiedostoa jossa 19 lisäystä ja 21 poistoa
  1. 19 21
      packages/upload/src/index.vue

+ 19 - 21
packages/upload/src/index.vue

@@ -83,6 +83,20 @@ export default {
     };
   },
 
+  watch: {
+    defaultFileList: {
+      immediate: true,
+      handler(fileList) {
+        this.fileList = fileList.map(item => {
+          item.status = 'finished';
+          item.percentage = 100;
+          item.uid = Date.now() + this.tempIndex++;
+          return item;
+        });
+      }
+    }
+  },
+
   methods: {
     handleStart(file) {
       file.uid = Date.now() + this.tempIndex++;
@@ -95,13 +109,11 @@ export default {
         showProgress: true
       };
 
-      if (this.thumbnailMode) {
-        try {
-          _file.url = URL.createObjectURL(file);
-        } catch (err) {
-          console.log(err);
-          return;
-        }
+      try {
+        _file.url = URL.createObjectURL(file);
+      } catch (err) {
+        console.error(err);
+        return;
       }
 
       this.fileList.push(_file);
@@ -158,20 +170,6 @@ export default {
     }
   },
 
-  watch: {
-    defaultFileList: {
-      immediate: true,
-      handler(fileList) {
-        this.fileList = fileList.map(item => {
-          item.status = 'finished';
-          item.percentage = 100;
-          item.uid = Date.now() + this.tempIndex++;
-          return item;
-        });
-      }
-    }
-  },
-
   render(h) {
     var uploadList;