小程序—获取openId(用来标识用户唯一)
- 在需要的页面.js下
getopenid(){
wx.cloud.callFunction({
name:'getOpenId',//注意名字是自己当前云函数中的openID的目录名
success(res){
console.log("获取云函数成功",res);
},
fail(res){
console.log("获取云函数失败",res);
}
})
},
2.在.wxml里
<button bindtap="getopenid">获取云函数openId</button>
然后调试即可