<u-upload imageMode='aspectFit' height="250" :maxCount='1' :fileList="fileList" @afterRead="uploadOK" @delete="delPic">
</u-upload>
::v-deep .u-upload__button {
width: 100% !important;
}
::v-deep .u-upload__wrap__preview__image {
width: 100% !important;
}
::v-deep .u-upload__wrap__preview {
width: 100% !important;
}
fileList: [],
uploadOK(e) {
this.fileList = [e.file]
},
delPic() {
this.fileList = []
},
save() {
if (this.fileList && this.fileList.length > 0) {
uniCloud.uploadFile({
cloudPath: 'blog/' + this.fileList[0].name,
filePath: this.fileList[0].url,
cloudPathAsRealPath: true
}).then(async (res) => {
console.log('图片在云存储里的路径为:', res.fileID)
})
}
}