客户端:
<template>
<view class="content">
<button @click="login">微信一键登录</button>
</view>
</template>
<script>
export default {
methods: {
login(){
uni.login({
provider:"weixin",
success: (res) => {
uniCloud.callFunction({
name:'weixinlogin',
data:{code:res.code},
success(res) {
console.log(res)
},
fail(err) {
console.log(err)
}
})
}
})
}
}
}
</script>
云函数:
'use strict';
const uniID= require('uni-id')
exports.main = async (event, context) => {
const res = await uniID.loginByWeixin({
code:event.code
})
return res
};
报错:
目录结构:
z***@qq.com
更新了还是报错呢
2022-03-27 15:54
tikyz
请问这个问题解决了吗
2022-04-16 23:25
3***@qq.com
回复 tikyz: 我也遇到了,把 common/uni-config-center/uni-id/config.json 配置文件中“//”及注释去掉就行了。
2022-05-01 00:46