技术 · 思考 · 实践 · 成长

首页/微信小程序/正文

微信小程序 转发 分享功能

微信小程序328 次阅读

一、转发

 //不加入参数

 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 运用


只有惜缘,才有缘分;只有惜友,才有友谊。

评论交流

0 条评论 · 支持多级回复
验证码
暂无评论,来说说你的想法吧

相关文章

继续阅读