From 4ef06d948899e393515bd62819f4f773766f9449 Mon Sep 17 00:00:00 2001
From: 唐耀东 <18861537@qq.com>
Date: 星期六, 16 七月 2022 13:16:42 +0800
Subject: [PATCH] 提交代码
---
src/components/FileUpload/index.vue | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index a5971f2..de44bec 100644
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -1,6 +1,7 @@
<template>
<div class="upload-file">
<el-upload
+ :disabled="disabled"
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
@@ -31,7 +32,7 @@
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
- <el-link :underline="false" @click="handleDelete(index)" type="danger">鍒犻櫎</el-link>
+ <el-link :underline="false" @click="handleDelete(index)" type="danger" :disabled="disabled">鍒犻櫎</el-link>
</div>
</li>
</transition-group>
@@ -54,17 +55,21 @@
// 澶у皬闄愬埗(MB)
fileSize: {
type: Number,
- default: 5,
+ default: 50,
},
// 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg']
fileType: {
type: Array,
- default: () => ["doc", "xls", "ppt", "txt", "pdf"],
+ default: () => ["doc", "xls", "ppt", "txt", "pdf", "zip"],
},
// 鏄惁鏄剧ず鎻愮ず
isShowTip: {
type: Boolean,
default: true
+ },
+ disabled: {
+ type: Boolean,
+ default: false
}
},
data() {
@@ -108,6 +113,14 @@
},
},
methods: {
+ startLoading() {
+ this.loading = this.$loading({
+ lock: true,
+ text: "Loading",
+ spinner: "el-icon-loading",
+ background: "rgba(0, 0, 0, 0.8)",
+ });
+ },
// 涓婁紶鍓嶆牎妫�鏍煎紡鍜屽ぇ灏�
handleBeforeUpload(file) {
// 鏍℃鏂囦欢绫诲瀷
@@ -125,6 +138,7 @@
this.$message.error(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`);
return false;
}
+ this.startLoading();
}
// 鏍℃鏂囦欢澶у皬
if (this.fileSize) {
@@ -148,6 +162,7 @@
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.$message.success("涓婁紶鎴愬姛");
+ this.loading.close();
this.fileList.push({ name: res.data.fileName, url: res.data.url });
this.$emit("input", this.listToString(this.fileList));
} else {
--
Gitblit v1.9.1