ionic2 如何引入第三方cordova插件

例如:cordova-plugin-wechat 這個插件能夠作微信登陸,分享支付等微信

 

首先第一步:ionic plugin add cordova-plugin-wechat --variable wechatappid= 你的appidapp

而後引用的時候:首先要在組件裏面  declare let Wechat;ionic

最後測試

Wechat.isInstalled(function (installed) {
      alert("Wechat installed: " + (installed ? "Yes" : "No"));
    }, function (reason) {
      alert("Failed: " + reason);
    });

結束;能夠正常調用裏面的方法了。spa

注意:使用該cordova插件時,測試時應該生成正式帶簽名的包;插件

相關文章
相關標籤/搜索