方法
// app 跳转小程序
export function community(path: string = 'pages/home/index') {
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: gn开头, //微信开放平台 --- 绑定的微信小程序的 --- 原始id
type: 0, //小程序版本 0-正式版; 1-测试版; 2-体验版。
path //小程序的页面,用传的参数在小程序接值判断跳转指定页面
});
}
}
);
}
使用
import { community } from '@/utils/share'
community('pages/home/index?goWinxi=1')
在页面获取路由参数
onLoad((options) => {
if(options?.goWinxi){
逻辑处理
}
})