一.前提提要:
我做微信小程序因为要用评论组件,所以从github上面获得LeanCloud的wxComment组件源码,链接如下:https://github.com/yicm/NewWxComment,根据它的步骤一步一步执行,其中有几处模糊的配置描述,不明白的可以跟着我一起配置。
二.跟着我一起配置:
1.注册LeanCloud账号,并创建过LeanCloud应用;
2.登陆LeanCloud账号,打开链接https://leancloud.cn/docs/weapp-domains.html,将显示域名配置到你的微信小程序服务器配置中;
3.设置小程序的 AppID 与 AppSecret
3.1 登录 微信公众平台,在设置 > 开发设置 中获得 AppID 与 AppSecret
3.2 前往 LeanCloud 控制台 > 组件 > 社交,保存「微信小程序」的 AppID 与 AppSecret
(注:这是“Please set the appid and the secret of weapp at LeanCloud console.”报错的解决方式)
4.(这里github文档上没写但是要配置)新建两个class:一个是comment,另一个是counter:
5.下载github的代码放在微信小程序上面,将LeanCloud自己的AppID和AppKey复制到NewWxComment.js对应位置;
AV.init({
appId: ‘your leancloud appid’,
appKey: ‘your leancloud appkey’,
});: