为什么调用云函数测试返回值为undefined??调用之后立即返回undefined,不会等待setTimeout执行
let todata = {
conid: '65a204aa337asdfsdfe79'
}
uniCloud.callFunction({
name: 'ceshi',
data: todata
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
'use strict';
exports.main = async (event, context) => {
//event为客户端上传的参数
console.log('event : ', event)
setTimeout(() => {
let redata = event
console.log(redata);
return redata
}, 2000);
};
7***@qq.com (作者)
谢谢,就是我想要的答案
2024-01-30 23:36
喜欢技术的前端
回复 7***@qq.com: 客气
2024-01-31 09:17