小程序與H5頁面之間的跳轉

小程序跳轉H5頁面 :
wxml:

<view bindtap="clickTab"></view>

js:

clickTab: function (e) {
    var that = this;
    wx.navigateTo({
      url: '/pages/webview/webview?url=' + encodeURIComponent(that.data.url),
    })
  },

需要一箇中間頁面webview
wxml:

<web-view src='{{url}}' bindmessage="bindGetMsg"></web-view>

js:

  onLoad: function (options) {
    // console.log(options)
    var that = this
    var url = decodeURIComponent(options.url);
    that.setData({
      url: url
    });
  },

H5頁面跳轉小程序:

$(''").click(function () {
	wx.miniProgram.navigateTo({url:'/pages/index/exponent'})
})

$('ele').on("click", function(){
		var href=$(this).find('a').attr('href').split('-')[1].split('.')[0];
   wx.miniProgram.navigateTo({
         url: '/pages/goods/goods,   //不需要參數的
    url: '/pages/goods/goods?goods_id='+href,   //需要參數的
  });
})

switchTab是跳轉到taBar頁面

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章