Przeglądaj źródła

上传文件组件添加失败提示

DESKTOP-O04BTUJ\muzen 3 lat temu
rodzic
commit
c73d572233
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      src/components/Upload/index.vue

+ 6 - 0
src/components/Upload/index.vue

@@ -12,6 +12,7 @@
       :before-upload="beforeUpload"
       :on-success="onSuccess"
       :on-progress="onProgress"
+      :on-error="onError"
     >
       <el-button v-if="type === 'file'" type="primary" style="margin:0">{{ title }}</el-button>
       <i v-else slot="default" class="el-icon-plus" />
@@ -111,6 +112,11 @@ export default {
       this.title = `${parseInt(file.percent - 1)}%`;
     },
 
+    // 上传失败
+    onError(err) {
+      this.title = `上传失败`
+    },
+
     // 删除
     handleRemove() {
       this.hideUpload = true;