From d3141851e6ab68d2092e342f19cd0246eaee643e Mon Sep 17 00:00:00 2001
From: Lou <luzhiping@qqyjz.com>
Date: Mon, 27 Nov 2023 17:20:36 +0800
Subject: [PATCH] update
---
mixin/uploadMixin.js | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/mixin/uploadMixin.js b/mixin/uploadMixin.js
index 3fa5cdc..1805ed9 100644
--- a/mixin/uploadMixin.js
+++ b/mixin/uploadMixin.js
@@ -64,14 +64,17 @@
},
//上传成功后对返回数据进行处理
- async afterReadImg(event) {
+ async afterReadImg(event,key="images") {
+ // console.log(key)
+ // console.log(this.form[key]);
this.showLoading()
var that = this;
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
- let fileListLen = this.form.images.length
+
+ let fileListLen = this.form[key].length
lists.map((item) => {
- this.form.images.push({
+ this.form[key].push({
...item,
status: 'uploading',
message: '上传中'
@@ -79,12 +82,31 @@
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
- that.form.images.splice(fileListLen, 1, Object.assign({}, {
+ that.form[key].splice(fileListLen, 1, Object.assign({}, {
url: result.data.link,
name:result.data.name
}))
fileListLen++
}
+
+ // let fileListLen = this.form.images.length
+ // lists.map((item) => {
+ // this.form.images.push({
+ // ...item,
+ // status: 'uploading',
+ // message: '上传中'
+ // })
+ // })
+ // for (let i = 0; i < lists.length; i++) {
+ // const result = await this.uploadFilePromise(lists[i].url)
+ // that.form.images.splice(fileListLen, 1, Object.assign({}, {
+ // url: result.data.link,
+ // name:result.data.name
+ // }))
+ // fileListLen++
+ // }
+
+
this.loadingClose()
},
--
Gitblit v1.9.3