日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ionic2微信支付,分享,登录

發布時間:2024/1/18 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ionic2微信支付,分享,登录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

安裝

安裝插件 cordova?plugin?add?cordova-plugin-wechat?--variable?wechatappid=YOUR_WECHAT_APPID 安裝ionic2、3調用 npm?install?wechat-chenyu?--save

You also need to install the Ionic Native package for each plugin you want to add. Please see the?Ionic Native documentation?for complete instructions on how to add and use the plugins.

Documentation

For the full Ionic Native documentation, please visit?https://ionicframework.com/docs/native/.

調用

To use a plugin, import and add the plugin provider to your?@NgModule, and then inject it where you wish to use it.

//?app.module.ts import?{WechatChenyu}?from?"wechat-chenyu"; ? ... ? @NgModule({ ??... ? ??providers:?[ ????... ????WechatChenyu ????... ??] ??... }) export?class?AppModule?{?} import?{WechatChenyu}?from?"wechat-chenyu"; ? @Component({?...?}) export?class?xxxxPage?{ constructor(private?wechatChenyu:?WechatChenyu){} ???//微信支付 ???//?obj?是從服務器獲取的參數 ???WchatPay(obj)?{ ???????console.log(obj); ???????let?params?=?{ ?????????partnerid:?obj.partnerid,?//?merchant?id ?????????prepayid:?obj.prepayid,?//?prepay?id ?????????noncestr:?obj.noncestr,?//?nonce ?????????timestamp:?obj.timestamp,?//?timestamp ?????????sign:?obj.sign ???????} ???????this.wechatChenyu.sendPaymentRequest(params).then((data)?=>?{ ????????? ?????????/*let?alert?=?this.alertCtrl.create({ ???????????title:?'充值提示!', ???????????subTitle:?JSON.stringify(data), ???????????buttons:?['確定'] ?????????}); ?????????alert.present(); ?????????*/ ?????????},?eoor?=>?{ ??????????? ?????????} ???????); ?????} ?????//判斷是否安裝微信 ?????isInstalled(){ ???????this.wechatChenyu.isInstalled().then(); ?????} ?????//微信登錄 ?????auth(){ ????????this.wechatChenyu.auth().then();? ?????} ?????//分享obj參考?https://www.npmjs.com/package/cordova-plugin-wechat ?????share(){ ?????????let?obj={ ?????????????????????message:?{ ?????????????????????????title:?"Hi,?there", ?????????????????????????description:?"This?is?description.", ?????????????????????????thumb:?"www/img/thumbnail.png", ?????????????????????????mediaTagName:?"TEST-TAG-001", ?????????????????????????messageExt:?"這是第三方帶的測試字段", ?????????????????????????messageAction:?"<action>dotalist</action>", ?????????????????????????media:?"YOUR_MEDIA_OBJECT_HERE" ?????????????????????}, ?????????????????????scene:?1???//?代表朋友圈、參數列表 ?????????????????}; ????????this.wechatChenyu.share(obj).then();?? ?????} ????? }

參數列表

scene 0, // 聊天界面 1, // 朋友圈 2 // 收藏

總結

以上是生活随笔為你收集整理的ionic2微信支付,分享,登录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。