1、首先在H5设置的入口文件中引入jweixin的sdk
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
</head>
2.使用jWeixin.miniProgram的方法跳转到小程序的对应页面。可以在控制台打印出jWeixin.miniProgram,检测是否引入成功。
jWeixin.miniProgram.reLaunch({
url: "/pageA/buy/buy?id="+goodId,
fail: function(res) {
console.log('fail');
},
complete: function(res) {
console.log('complete');
}
})