uni-app app跳转mini程序

记录uni-app 开发的App如何跳转mini程序

1. uni-app打开分享功能

打开共享功能

2. 获取mini程序原始id

小程序的原始id获取url

点击设置
AppID(小程序ID)

3. coding

template

<view class="" @tap="test">1

      </view>

data

sweixin: ''

onLoad

let that = this
            // #ifdef APP-PLUS  
            console.log("plus");
            plus.share.getServices(function(s) {
                var shares = {};
                for (var i = 0; i < s.length; i++) {
                    var t = s[i];
                    console.log(t);
                    shares[t.id] = t;
                    console.log(t.id);
                }
                that.sweixin = shares['weixin']

            }, function(e) {
                console.log("获取分享服务列表失败:" + e.message);
            });
            //#endif

methods

test: function() {
                var n = this;
                //#ifdef APP-PLUS  
                console.log(n.sweixin);
                n.sweixin ? n.sweixin.launchMiniProgram({
                    id: '请填写mini程序的原始id',
                    type: 0, //小程序版本  0-正式版; 1-测试版; 2-体验版。
                    path: 'pages/home/home?id=' + 1 //小程序的页面,用传的参数在小程序接值判断跳转指定页面
                }) : plus.nativeUI.alert('当前环境不支持微信操作!');

                //#endif  
            },
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容