当前位置:   article > 正文

Vue项目(H5)与微信小程序来回跳转_vue h5跳转小程序

vue h5跳转小程序
新建H5页面

在小程序里面新建一个名为H5的文件夹,以及H5页面

  1. H5.WXML
  2. <web-view src="{{h5Url}}" bindmessage="handleGetMessage"></web-view>
  3. H5.JS
  4. data: {
  5. h5Url:'https://xxx.com/login' 要跳转的H5页面
  6. },
  7. H5回来的回调方法
  8. handleGetMessage: function (e) {
  9. console.log('handleGetMessage', e)
  10. if (e.detail.data[0].result == 'success') {
  11. // 确认支用-签约成功调用
  12. }
  13. },
  14. onLoad(options){
  15. H5跳转回来后的参数在options里面
  16. }
 Vue处理
  1. 在index.html里面新增
  2. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  3. // 跳回小程序
  4. goBackMini() {
  5. wx.miniProgram.navigateTo({
  6. url: `/pages/insure/pay?paymentNo=33&checkNo=222`, // 指定跳转至小程序页面的路径
  7. success: (res) => {
  8. console.log(res); // 页面跳转成功的回调函数
  9. },
  10. fail: (err) => {
  11. console.log(err); // 页面跳转失败的回调函数
  12. },
  13. });
  14. },

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读