uniapp中app跳转微信和微信小程序跳转微信小程序的方法

1.uniapp中微信小程序跳转微信小程序

uni.navigateToMiniProgram({

            appId:"appId"//微信小程序id

            path: "pages/index/index", // 不填默认首页        

            extraData:{

                  'data1': 'test'

            }, //传递给页面的参数

            success(res) {

            console.log("跳转成功");

            },

            fail(res) {

            console.log(res, "调用失败");

            }

})

注:使用的是uniapp的跳转方法

2.uniapp中app跳转微信小程序

 plus.share.getServices(res => {

      let sweixin = null;

      sweixin = res.find(i => i.id === 'weixin')

      if (sweixin) {

         // 分享跳转到微信小程序

         sweixin.launchMiniProgram({

         id: "gh_...",//微信小程序原生id

         path:"pages/index/index", //    打开小程序的页面路径,不传默认跳转首页

         type: 0 //     微信小程序版本类型,可取值: 0-正式版; 1-测试版; 2-体验版。 默认值为0。

      })

      } else {

            uni.showToast({

            title: '请安装微信',

            icon: 'none'

            })

      }

   }, err => {

      console.log("分享失败"); // 获取分享服务列表失败

   });

3.uniapp中app唤起微信并跳转企业微信用户页的方法

let url ="weixin://biz/ww/profile/"+url
   plus.runtime.openURL(url); //前缀是直接打开微信,如果没有会先跳转浏览器

4.uniapp中app唤起微信小程序并跳转到企业微信用户的方法

   plus.share.getServices(res => {
                 wechat = res.find(i => i.id === 'weixin')
                    if (wechat) {
                        wechat.openCustomerServiceChat({
                            corpid: '微信企业ID',//企业ID
                            url: 'https://work.weixin.qq.com/'+url,//客服地址
                        }, src => {
                            console.log("success:")
                        }, err => {
                            console.log("error:")
                        })
                    } else {
                        uni.showToast({
                            title: '当前环境不支持微信操作',icon:"error"
                        });
                    }
                });

 

  • 9
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值