计算机网络/计算机科学与应用/系统/运维/开发

微信小程序 转发 分享功能

一、转发

 //不加入参数

 onShareAppMessage: function() {
     let users = wx.getStorageSync('user');
     if (res.from === 'button') {}
     return {
         title: '转发',
         path: '/pages/index/index',
         success: function(res) {}
     }
 }

//加入参数

onShareAppMessage: function() {
 let users = wx.getStorageSync('user');
 if (res.from === 'button') {}
     return {
         title: '转发',
         path: '/pages/index/index?from_uid=' + users.id,
         success: function(res) {}
     }
 }

二、分享

分享必须做成button 且加上 open-type="share"

onShareAppMessage: function (res) {
     if (res.from === 'button') {}
     return {
     title: '转发',
     path: '/pages/index/community/topic/topic',
         success: function (res) {
             console.log('成功', res)
         }
     }
 }

加入参数

//转发

 onShareAppMessage: function (res) {
 if (res.from === 'button') {
 
 }
 return {
 title: '转发',
 path: '/pages/index/community/topic/topic?jsonStr=' + this.data.list,
 success: function (res) {
 console.log('成功', res)
 }
 }
 }

注意:转发的参数要在onLoad 的options 运用


知识是抵御一切灾祸的盾牌

评论

^