1.manifest.json中配置
?appid 在微信開放平臺申請應用的AppID,先到微信開放平臺申請移動應用
然后在微信開放平臺管理中心綁定小程序,拿到原始小程序原始id
2.app拉起小程序
// #ifdef APP-PLUS
?? ??? ??? ??? ?plus.share.getServices(
?? ??? ??? ??? ??? ?res => {
?? ??? ??? ??? ??? ??? ?let sweixin = null;
?? ??? ??? ??? ??? ??? ?for (let i in res) {
?? ??? ??? ??? ??? ??? ??? ?if (res[i].id == 'weixin') {
?? ??? ??? ??? ??? ??? ??? ??? ?sweixin = res[i];
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?//喚醒微信小程序
?? ??? ??? ??? ??? ??? ?if (sweixin) {
?? ??? ??? ??? ??? ??? ??? ?sweixin.launchMiniProgram({
?? ??? ??? ??? ??? ??? ??? ??? ?id: 'ghXXXXX', //微信開放平臺 --- 綁定的微信小程序的 --- 原始id
?? ??? ??? ??? ??? ??? ??? ??? ?type: 2, //小程序版本 ?0-正式版; 1-測試版; 2-體驗版。
?? ??? ??? ??? ??? ??? ??? ??? ?path: 'pages/index/index' //小程序的頁面,用傳的參數(shù)在小程序接值判斷跳轉(zhuǎn)指定頁面
?? ??? ??? ??? ??? ??? ??? ?});
?? ??? ??? ??? ??? ??? ?} else {
?? ??? ??? ??? ??? ??? ??? ?console.log("未安裝微信邏輯")
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?);
?? ??? ??? ??? ?// #endif
注:測app跳轉(zhuǎn)小程序需打自定義基座
文章來源:http://www.zghlxwxcb.cn/news/detail-622483.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-622483.html
到了這里,關(guān)于uniapp中 app跳轉(zhuǎn)微信小程序的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!