<Upload
ref="upload"
:show-upload-list="false"
:on-success="handleSuccess"
:format="['jpg']"
:max-size="10240"
:on-format-error="handleFormatError"
:on-exceeded-size="exceededSize"
:on-progress="progress"
:before-upload="beforeUpload"
:data="uploadData" //上传参数
multiple
type="drag"
:action="action" //接口路径
:class="{inline:btnInfo}">
<Button type="success" icon="upload" v-if="btnInfo">{{btnInfo}}</Button>
<div style="padding: 20px 0" v-if="!btnInfo">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>{{title}}</p>
</div>
</Upload>
//上传之前
beforeUpload(){
this.uploadData = {
id: 12
}
let promise = new Promise((resolve) => {
this.$nextTick(function () {
resolve(true);
});
});
return promise; //通过返回一个promis对象解决
},