docs(Uploader): fix uploadToCloud demo

https://github.com/youzan/vant-weapp/issues/4360
This commit is contained in:
neverland 2021-07-25 10:53:21 +08:00 committed by GitHub
parent e9aa946db0
commit 3238dfed1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,7 +190,7 @@ Page({
```js ```js
// 上传图片 // 上传图片
uploadToCloud() { uploadToCloud() {
wx.cloud.init(); wx.cloud.init();
const { fileList } = this.data; const { fileList } = this.data;
if (!fileList.length) { if (!fileList.length) {
@ -200,7 +200,7 @@ uploadToCloud() {
Promise.all(uploadTasks) Promise.all(uploadTasks)
.then(data => { .then(data => {
wx.showToast({ title: '上传成功', icon: 'none' }); wx.showToast({ title: '上传成功', icon: 'none' });
const newFileList = data.map(item => { url: item.fileID }); const newFileList = data.map(item => ({ url: item.fileID }));
this.setData({ cloudPath: data, fileList: newFileList }); this.setData({ cloudPath: data, fileList: newFileList });
}) })
.catch(e => { .catch(e => {