浏览代码

Upload: convert var to const and let

thegatheringstorm 8 年之前
父节点
当前提交
4d2fac6f60
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. 9 9
      packages/upload/src/index.vue

+ 9 - 9
packages/upload/src/index.vue

@@ -139,13 +139,13 @@ export default {
       this.onChange(file, this.uploadFiles);
     },
     handleProgress(ev, rawFile) {
-      var file = this.getFile(rawFile);
+      const file = this.getFile(rawFile);
       this.onProgress(ev, file, this.uploadFiles);
       file.status = 'uploading';
       file.percentage = ev.percent || 0;
     },
     handleSuccess(res, rawFile) {
-      var file = this.getFile(rawFile);
+      const file = this.getFile(rawFile);
 
       if (file) {
         file.status = 'success';
@@ -156,8 +156,8 @@ export default {
       }
     },
     handleError(err, rawFile) {
-      var file = this.getFile(rawFile);
-      var fileList = this.uploadFiles;
+      const file = this.getFile(rawFile);
+      const fileList = this.uploadFiles;
 
       file.status = 'fail';
 
@@ -171,13 +171,13 @@ export default {
         file = this.getFile(raw);
       }
       this.abort(file);
-      var fileList = this.uploadFiles;
+      let fileList = this.uploadFiles;
       fileList.splice(fileList.indexOf(file), 1);
       this.onRemove(file, fileList);
     },
     getFile(rawFile) {
-      var fileList = this.uploadFiles;
-      var target;
+      let fileList = this.uploadFiles;
+      let target;
       fileList.every(item => {
         target = rawFile.uid === item.uid ? item : null;
         return !target;
@@ -209,7 +209,7 @@ export default {
   },
 
   render(h) {
-    var uploadList;
+    let uploadList;
 
     if (this.showFileList) {
       uploadList = (
@@ -223,7 +223,7 @@ export default {
       );
     }
 
-    var uploadData = {
+    const uploadData = {
       props: {
         type: this.type,
         drag: this.drag,