記錄uni-app 開發(fā)的App如何跳轉(zhuǎn)mini程序
1. uni-app打開分享功能
打開共享功能
2. 獲取mini程序原始id
點擊設(shè)置
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("獲取分享服務(wù)列表失斖盖摇:" + e.message);
});
//#endif
methods
test: function() {
var n = this;
//#ifdef APP-PLUS
console.log(n.sweixin);
n.sweixin ? n.sweixin.launchMiniProgram({
id: '請?zhí)顚憁ini程序的原始id',
type: 0, //小程序版本 0-正式版; 1-測試版; 2-體驗版乔询。
path: 'pages/home/home?id=' + 1 //小程序的頁面,用傳的參數(shù)在小程序接值判斷跳轉(zhuǎn)指定頁面
}) : plus.nativeUI.alert('當(dāng)前環(huán)境不支持微信操作!');
//#endif
},