提交 55855e82 编写于 作者: 雪洛's avatar 雪洛

docs: format code

上级 71bc6ae6
......@@ -107,44 +107,43 @@ onUploadProgress: function(progressEvent) {
```javascript
//前端代码
uni.chooseImage({
count: 1,
success(res) {
console.log(res);
if (res.tempFilePaths.length > 0) {
let filePath = res.tempFilePaths[0]
//进行上传操作
// promise方式
const result = await uniCloud.uploadFile({
filePath: filePath,
count: 1,
success(res) {
console.log(res);
if (res.tempFilePaths.length > 0) {
let filePath = res.tempFilePaths[0]
//进行上传操作
// promise方式
const result = await uniCloud.uploadFile({
filePath: filePath,
cloudPath: 'a.jpg',
onUploadProgress: function(progressEvent) {
console.log(progressEvent);
var percentCompleted = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
}
});
// callback方式,与promise方式二选一即可
uniCloud.uploadFile({
filePath: filePath,
onUploadProgress: function(progressEvent) {
console.log(progressEvent);
var percentCompleted = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
}
});
// callback方式,与promise方式二选一即可
uniCloud.uploadFile({
filePath: filePath,
cloudPath: 'a.jpg',
onUploadProgress: function(progressEvent) {
console.log(progressEvent);
var percentCompleted = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
},
success() {},
fail() {},
complete() {}
});
}
}
});
},
success() {},
fail() {},
complete() {}
});
}
}
});
```
**Tips**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册