app 跳转小程序

<template>
    <view>
        <button @click="nav">跳转小程序</button>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                sweixin: 'weixin'
            }
        },
        onl oad() {
            var that = this
            // #ifdef APP-PLUS
            plus.share.getServices(function(s) {
                for (var i = 0; i < s.length; i++) {
                    var t = s[i];
					if (t.id == 'weixin') {
						that.sweixin = t;
					}
                }
            }, function(e) {
                console.log("获取分享服务列表失败:" + e.message);
            });
            //#endif
        },
        methods: {
            nav() {
                var n = this;
                console.log('n ===== ', n.sweixi)
                //#ifdef APP-PLUS
                console.log('sweixin ===== ', n.sweixin);
                n.sweixin ? n.sweixin.launchMiniProgram({
                    id: 'gh_bdad127a996f' // 要修改
                }) : plus.nativeUI.alert('当前环境不支持微信操作!');
                //#endif
            }

        }
    }
</script>
上一篇:C语言迷宫求解——栈的应用


下一篇:09 暂时