<a-upload
:file-list="fileList"
:maxCount="1"
action="#"
:customRequest="handleChildChange"
:remove="handleRemove"
>
<a-button> <a-icon type="upload" /> 上传apk文件 </a-button>
</a-upload>
handleChildChange(info) {
// 定义处理函数来接收数据
let latestFile = info.file // 直接取最新的文件,因为:maxCount="1"已限制只上传一个文件
// 如果文件上传成功并返回了URL,设置file.url
if (latestFile.status === 'done' && latestFile.response) {
latestFile.url = latestFile.response.url
}
// 更新fileList需要维护一个数组,尽管只显示最新的
this.fileList = [latestFile] // 仅保留最新的一个文件
// 将最新的文件赋值给model.file
this.model.file = latestFile
},