Commit 4e48c5f9 authored by 张冬's avatar 张冬

上传文件优化

parent 842be083
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
}, },
max: { max: {
type: Number, type: Number,
default: 99 default: 100
} }
}, },
data() { data() {
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
this.$emit('input', value); this.$emit('input', value);
}, },
beforeUpload(file) { beforeUpload(file) {
this.loading=true
const max = this.max; const max = this.max;
const isLt2M = file.size / 1024 / 1024 < max; const isLt2M = file.size / 1024 / 1024 < max;
if (!isLt2M) { if (!isLt2M) {
...@@ -109,6 +109,7 @@ export default { ...@@ -109,6 +109,7 @@ export default {
this.$message.warning(`每次只能上传 ${this.limit} 个文件`); this.$message.warning(`每次只能上传 ${this.limit} 个文件`);
return; return;
} }
this.loading=true
// 生成的文件名称 // 生成的文件名称
let objName = getFileNameUUID(); let objName = getFileNameUUID();
// 调用 ali-oss 中的方法 // 调用 ali-oss 中的方法
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
action action
multiple multiple
> >
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary" v-loading.fullscreen.lock="loading">点击上传</el-button>
<div slot="tip" class="el-upload__tip">{{ tip }}</div> <div slot="tip" class="el-upload__tip">{{ tip }}</div>
</el-upload> </el-upload>
</div> </div>
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
}, },
max: { max: {
type: Number, type: Number,
default: 99 default: 100
}, },
fileList: { fileList: {
type: Array, type: Array,
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
tableData: [], tableData: [],
columns: [ columns: [
{ {
...@@ -151,6 +152,7 @@ export default { ...@@ -151,6 +152,7 @@ export default {
this.$message.warning(`每次只能上传 ${this.limit} 个文件`); this.$message.warning(`每次只能上传 ${this.limit} 个文件`);
return; return;
} }
this.loading=true
// 生成的文件名称 // 生成的文件名称
let objName = getFileNameUUID(); let objName = getFileNameUUID();
// 调用 ali-oss 中的方法 // 调用 ali-oss 中的方法
...@@ -165,6 +167,7 @@ export default { ...@@ -165,6 +167,7 @@ export default {
res.fileUrl = res.url; res.fileUrl = res.url;
this.fileList.push(res); this.fileList.push(res);
this.$emit('input', this.fileList); this.$emit('input', this.fileList);
this.loading=false
}); });
}, },
handleRemove(file, fileList, index) { handleRemove(file, fileList, index) {
......
...@@ -98,4 +98,7 @@ export default { ...@@ -98,4 +98,7 @@ export default {
.sidebar > ul { .sidebar > ul {
height: 100%; height: 100%;
} }
.el-menu-item i {
color: #AFB0B3;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment