uniapp app跳转微信小程序

plus.share.getServices((s) => {  
	let sweixin = {};  
	for (let i = 0; i < s.length; i++) {  
		let share = s[i];  
		if (share.id === 'weixin') {  
			sweixin = share  
		}  
	}  
    //这个是自己需要传递的参数
	let _params={
		jsConfig,
		orderId
	}
	//小程序参数,必填  
	let WeixinMiniProgramOptions = {  
        // type:2,//可取值: 0-正式版; 1-测试版; 2-体验版。 默认值为0。
		id: 'gh_d806d1382911111e9',  //小程序原始id
		path:'/pages/order_pay_status/tohsb?         
        config='+encodeURIComponent(JSON.stringify(_params))//可指定打开的页面  
	}  
	sweixin ? sweixin.launchMiniProgram(WeixinMiniProgramOptions) : plus.nativeUI.alert(  
			'当前环境不支持微信操作!');  
	}, function(e) {  
		console.log("获取分享服务列表失败:" + e.message);  
});  

登录微信公众平台原始id这里获取

小程序接收参数

  onLoad(option) {
        const config= JSON.parse(decodeURIComponent(option.config))
        const {jsConfig,orderId} = config
  }

猜你喜欢

转载自blog.csdn.net/m0_59203969/article/details/134670001