|
|
@ -4,7 +4,9 @@ |
|
|
|
:action="uploadFileUrl" |
|
|
|
:action="uploadFileUrl" |
|
|
|
:before-upload="handleBeforeUpload" |
|
|
|
:before-upload="handleBeforeUpload" |
|
|
|
:file-list="fileList" |
|
|
|
:file-list="fileList" |
|
|
|
|
|
|
|
:limit="limit" |
|
|
|
:on-error="handleUploadError" |
|
|
|
:on-error="handleUploadError" |
|
|
|
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
:on-success="handleUploadSuccess" |
|
|
|
:on-success="handleUploadSuccess" |
|
|
|
:show-file-list="false" |
|
|
|
:show-file-list="false" |
|
|
|
:headers="headers" |
|
|
|
:headers="headers" |
|
|
@ -44,6 +46,11 @@ export default { |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
// 值 |
|
|
|
// 值 |
|
|
|
value: [String, Object, Array], |
|
|
|
value: [String, Object, Array], |
|
|
|
|
|
|
|
// 数量限制 |
|
|
|
|
|
|
|
limit: { |
|
|
|
|
|
|
|
type: Number, |
|
|
|
|
|
|
|
default: 5, |
|
|
|
|
|
|
|
}, |
|
|
|
// 大小限制(MB) |
|
|
|
// 大小限制(MB) |
|
|
|
fileSize: { |
|
|
|
fileSize: { |
|
|
|
type: Number, |
|
|
|
type: Number, |
|
|
@ -129,6 +136,10 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 文件个数超出 |
|
|
|
|
|
|
|
handleExceed() { |
|
|
|
|
|
|
|
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); |
|
|
|
|
|
|
|
}, |
|
|
|
// 上传失败 |
|
|
|
// 上传失败 |
|
|
|
handleUploadError(err) { |
|
|
|
handleUploadError(err) { |
|
|
|
this.$message.error("上传失败, 请重试"); |
|
|
|
this.$message.error("上传失败, 请重试"); |
|
|
|