w***@126.com
w***@126.com
  • 发布:2021-07-01 14:22
  • 更新:2021-07-15 19:34
  • 阅读:813

微信分享onShareAppMessage方法return路径中设置的参数设置不成功

分类:uni-app

环境:微信小程序
使用场景:在需要分享的页面使用button open-type="share"组件触发分享事件onShareAppMessage,设置return{},在onLoad(options){}方法获取options中的参数出现bug。

注意:第一次分享页面,点击分享链接进入时能正确获取options中的id=1参数,但是第二次分享该页面同时在onShareAppMessage方法的return中设置id=2,则在onLoad方法的options中获取id还是1,并不是第二次设置id=2。

请帮忙看下这是不是uni-app的bug

代码如下:

<button open-type="share" class="btn btn-share">我也想分享助力</button>  

onLoad: function (options) {  
    let id= options.id;//点击第二次分享的链接进入应该获取到id=2,但是怎么设置都是id=1  
    let source = options.source||0;  
    console.log("onLoad.id:"+id);  
    console.log("onLoad.source:"+source);  
},  
onShareAppMessage:function(res){  
    let that = this;  
    let source = that.$data.source;  
    if(source == 0){  
        return {  
            title: '0元包邮,就差你啦!',  
            path: '/pages/marketing/help_free_shipping/index?source=1&id=1'  
        }  
    }else{  
        return {  
            title: '0元包邮,就差你啦!',  
            path: '/pages/marketing/help_free_shipping/index?source=1&id=2'  
        }  
    }  
}
2021-07-01 14:22 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

使用原生的微信小程序测试一下是否有同样问题?

  • w***@126.com (作者)

    微信小程序会同步修复这个bug的吧 [握手]

    2021-07-15 17:31

  • DCloud_UNI_GSQ

    回复 w***@126.com: 之前的回复错了(当成另外一个问题了)。已修改回复。

    2021-07-15 19:35

该问题目前已经被锁定, 无法添加新回复