<template>
<view>
<button @click="nav">跳转小程序</button>
</view>
</template>
<script>
export default {
data() {
return {
sweixin: 'weixin'
}
},
onLoad() {
var that = this
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);
});
},
methods: {
nav() {
var n = this;
console.log('n ===== ', n.sweixi)
console.log('sweixin ===== ', n.sweixin);
n.sweixin ? n.sweixin.launchMiniProgram({
id: 'gh_bdad127a996f',
path = "/pages/index/index?sharetype=share&id=" + id
}) : plus.nativeUI.alert('当前环境不支持微信操作!');
}
}
}
</script>