从uniapp 写的app跳转到uniapp 写的小程序
plus.share.getServices(res => {
this.sweixin = res.find(i => i.id === 'weixin')
if (this.sweixin) {
// 分享跳转到微信小程序
this.sweixin.launchMiniProgram({
id: "", // 关联微信小程序的原始ID("g_"开头的字符串)
path: ``, // 打开小程序的页面路径,不传默认跳转首页
type: 0 // 微信小程序版本类型,可取值: 0-正式版; 1-测试版; 2-体验版。 默认值为0。
}, res => {
console.log('成功唤起微信小程序');
}, err => {
console.log('失败');
})
} else {
// this.$u.toast('操作失败,请稍后再试')
}
}, err => {
// 获取分享服务列表失败
// this.$u.toast('操作失败,请稍后再试')
});
从小程序回到app
<button class="loginButton" open-type="launchApp" app-parameter="wechat" binderror="launchAppError">返回APP</button>
网友评论