Commit 9bca25ba authored by 杨南鸿's avatar 杨南鸿

更新upload组件参数

parent 4b4f75fa
...@@ -103,6 +103,10 @@ export default { ...@@ -103,6 +103,10 @@ export default {
onExceed: { onExceed: {
type: Function, type: Function,
default: noop default: noop
},
needTitle: {
type: Boolean,
default: false
} }
}, },
...@@ -306,6 +310,7 @@ export default { ...@@ -306,6 +310,7 @@ export default {
listType: this.listType, listType: this.listType,
disabled: this.uploadDisabled, disabled: this.uploadDisabled,
limit: this.limit, limit: this.limit,
needTitle: this.needTitle,
'on-exceed': this.onExceed, 'on-exceed': this.onExceed,
'on-start': this.handleStart, 'on-start': this.handleStart,
'on-progress': this.handleProgress, 'on-progress': this.handleProgress,
......
...@@ -9,6 +9,10 @@ export default { ...@@ -9,6 +9,10 @@ export default {
}, },
props: { props: {
type: String, type: String,
needTitle: {
type: Boolean,
default: false
},
action: { action: {
type: String, type: String,
required: true required: true
...@@ -85,6 +89,11 @@ export default { ...@@ -85,6 +89,11 @@ export default {
this.$refs.input.value = null; this.$refs.input.value = null;
if (!this.beforeUpload) { if (!this.beforeUpload) {
return this.post(rawFile);
}
if (!this.beforeUpload) {
if (this.needTitle) {
let fileIndex = this.fileList.findIndex(o => o.uid === rawFile.uid); let fileIndex = this.fileList.findIndex(o => o.uid === rawFile.uid);
let file = this.fileList[fileIndex]; let file = this.fileList[fileIndex];
let filename = file.name; let filename = file.name;
...@@ -100,6 +109,9 @@ export default { ...@@ -100,6 +109,9 @@ export default {
} }
} }
return this.post(rawFile, filename, fileIndex); return this.post(rawFile, filename, fileIndex);
} else {
return this.post(rawFile);
}
} }
const before = this.beforeUpload(rawFile); const before = this.beforeUpload(rawFile);
......
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