Authored by zhangwenxue

reature: make drag-file-upload filetype and filesize configurable

... ... @@ -19,7 +19,7 @@
:on-error="handleError"
:default-file-list="defaultList"
:format="format"
:max-size="2048"
:max-size="maxSize"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
action="/Api/upload/image"
... ... @@ -53,6 +53,16 @@ export default {
return 'goodsimg';
},
},
maxSize: {
type: Number,
default: 2048,
},
formatMaxSizeMsg: {
type: Function,
default() {
return file => '文件 ' + file.name + ' 太大,不能超过 2M。';
},
},
format: {
type: Array,
default() {
... ... @@ -126,7 +136,7 @@ export default {
handleMaxSize(file) {
this.$Notice.warning({
title: '超出文件大小限制',
desc: '文件 ' + file.name + ' 太大,不能超过 2M。',
desc: this.formatMaxSizeMsg(file),
});
},
browseOnline() {
... ...