uniapp app跳转小程序
function LaunchMiniProgram (miniId,miniPath){
plus.share.getServices(function(s){
let sweixin = null;
for(let i=0;i<s.length;i++){
if(s[i].id == 'weixin'){
sweixin = s[i];
}
}
if(sweixin){
console.log('调起小程序',s)
sweixin.launchMiniProgram({
id:miniId,
path:miniPath
},function(){
return true;
},function(e){
console.log("微信唤起失败",e);
uni.showToast({
title:'微信唤起失败,请检查是否有微信应用',
icon:'none'
})
return false;
})
}else{
uni.showToast({
title:'微信唤起失败,请检查是否有微信应用',
icon:'none',
duration:3000
})
return false;
}
}, function(e){
console.log("微信唤起失败",e);
uni.showToast({
title:'微信唤起失败,请重试',
icon:'none',
duration:3000
})
return false;
});
uni.navigateToMiniProgram({
appId: miniId,
path: miniPath,
success(res) {
return true
},
fail(res){
uni.showToast({
title:'跳转小程序失败',
icon:'none',
duration:3000
})
console.log('跳转小程序失败',res)
return false;
}
})
}
文章评论