通过在webView中使用wx.miniProgram接口实现跳转回小程序页面
1.首先,先引用微信'path/to/page'路径;
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
wx.miniProgram.navigateTo({ url: '/path/to/page' })
2.微信路径引用后,通过wx.miniProgram.postMessage传递参数,使用bindmessage事件监听实现跳转;
wx.miniProgram.postMessage({
data: {
password: d1,
random: Random,
randJnlNo: randJnlNo
}
});
wx.miniProgram.navigateBack(); // 返回上一页面
//wxml文件:
<web-view src="{{wxmp}}/password-control-set?token={{token}}&tfccode={{tfccode}}" bindmessage="postMessage">
//json文件:postMessage: function (e) { //webview页面向小程序传递参数)
console.log(e.detail.data)
}