微信小程序页面分享出去后用户无法通过分享页面返回首页bug解决方法
本质就是设置一个变量isshare来判断是否是分享页面中进入的
页面js-data中设置
isshare: 0,//不是分享页面进入
onShareAppMessage: function () {
    return {
      title: 'xxx',
      path: 'pages/MyPages/detail?isshare=1&&id=' + this.data.id
    }
  },
  backHome: function () {
    wx.reLaunch({
      url: '/pages/home/index'
    })
  }onload
    if (options.isshare == 1) {
      console.log('是分享进入');
      this.setData({
        'isshare': options.isshare
      })
    }wxml
<image wx:if="{{isshare}}" bindtap='backHome' class='d-back-home' src='http://cdn.xcx.pemarket.com.cn/icon-Return%20to%20the%20home%20page.png' lazy-load></image>
/* 回到首页icon,固定定位*/
.d-back-home {
  position: fixed;
  width: 96rpx;
  height: 96rpx;
  right: 30rpx;
  bottom: 166rpx;
  z-index: 10000;
}

本文来自博客园,作者:JackieDYH,转载请注明原文链接:https://www.cnblogs.com/JackieDYH/p/17634430.html

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号