在IonicApp中调用微信进行登录

来源:互联网 发布:阿里云香港服务器 翻墙 编辑:程序博客网 时间:2024/06/11 15:12

1.安装插件

cordova plugin add cordova-plugin-wechat --variable wechatappid=YOUR_WECHAT_APPID

2.使用方法

$scope.goLogin = function () {    var scope = "snsapi_userinfo",        state = "_" + (+new Date());    Wechat.auth(scope, state, function (response) {        // alert弹出返回的JSON        alert(JSON.stringify(response));    }, function (reason) {        alert("Failed: " + reason);    });};

3.插件文档

https://github.com/xu-li/cordova-plugin-wechat

0 0
原创粉丝点击