Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
26ad7f53
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26ad7f53
编写于
4月 20, 2021
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: uniCloud faq
上级
4619fcbc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
1 deletion
+54
-1
docs/uniCloud/faq.md
docs/uniCloud/faq.md
+54
-1
未找到文件。
docs/uniCloud/faq.md
浏览文件 @
26ad7f53
...
...
@@ -294,4 +294,57 @@ exports.main = async function(event){
!
[
设置授权服务空间
](
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/b3c234a7-e514-4b14-b33d-e7322130bd7d.jpg
)
5.
点击第4步弹出界面的
`保存按钮`
以及第3步的
`保存权限设置`
按钮
\ No newline at end of file
5.
点击第4步弹出界面的
`保存按钮`
以及第3步的
`保存权限设置`
按钮
### 如何使用promise/async/await@promise
uniCloud客户端callFunction及数据库相关接口会返回Promise类型结果,请参考以下写法使用:
```
html
// index.vue
<template>
<view
class=
"content"
>
<button
type=
"default"
@
click=
"testThen"
>
promise+then
</button>
<button
type=
"default"
@
click=
"testAwait"
>
async+await
</button>
</view>
</template>
<script>
export
default
{
data
()
{
return
{}
},
methods
:
{
testThen
()
{
uniCloud
.
callFunction
({
name
:
'
test
'
}).
then
(
res
=>
{
console
.
log
(
res
)
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
},
async
testAwait
()
{
const
res
=
await
uniCloud
.
callFunction
({
name
:
'
test
'
})
console
.
log
(
res
)
// 如需捕获错误需使用如下写法
// try {
// const res = await uniCloud.callFunction({
// name: 'test'
// })
// console.log(res)
// } catch (err) {
// console.error(err)
// }
}
}
}
</script>
<style>
</style>
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录