云函数怎么接收参数?
发布于 7 年前 作者 sxiong 1017 次浏览 来自 官方Issues

已经定义了调用云函数,并将参数传递到云函数中,请问如何在云函数中接收参数呢?

调用云函数代码如下:

wx.cloud.callFunction({

name:“queryDetail”,

data:{

name:that.data.pdname,

}

}).then(res=>{

// console.log(res.result)

that.setData({

alllist:res.result

})

2 回复

多谢,已经传递成功了

async(event, context)  event.xx就是你传入的参数。

// 获取小程序码
 
exports.main =  async(event, context)  =>  {
 
let result =  await cloud.openapi.wxacode.createQRCode({
 
path:  'pages/shop/goods/goods?goods_id='  + event.goods_id,
 
//是否透明底图
 
is_hyaline:  true,
 
width:  300
 
});

 
return result
 
}

回到顶部