美文网首页
从app到微信小程序相互跳转

从app到微信小程序相互跳转

作者: Morbid_D | 来源:发表于2022-07-19 15:17 被阅读0次

从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>

相关文章

网友评论

      本文标题:从app到微信小程序相互跳转

      本文链接:https://www.haomeiwen.com/subject/qfaeirtx.html