收藏
回答

onShareAppMessage转发页面,别人打开数据全为空

框架类型 问题类型 API/组件名称 终端类型 操作系统 微信版本 基础库版本
小程序 Bug onShareAppMessage(options) 客户端 iOS 6.7.0 2.1.2

onShareAppMessage转发页面,自己看到都是正常的,但是转发给别人数据全是空值,onLoad获取不到全局和从别的页面传递的数据。

求大神帮解答。


<!--pages/detailedJD/detailedJD.wxml-->

<view wx:for="{{JobDescription}}" wx:key="0">

<view class="part1">

<view class="columnList">

<view class="rowList rowList1">

<text class="company">{{item.jobTitle}}</text>

<text class="duration">{{duration}}天前</text>

</view>  <!--end rowList-->

<text class="location">{{item.address}}∙{{item.company}}</text>        

</view>  <!--end columnList-->

</view>

<view class="separate"></view>


<scroll-view class="scroll part2" scroll-y="true" enable-back-to-top="true">

<view class="columnList">

<text class="job">职位详情:</text>

<text class="jobdescription" style="width:{{normalWidth}}px;">{{item.jobDescription}}</text>

<image class="jobimg" style="width:{{normalWidth}}px;"src="{{item.jobImage}}"></image>        

</view>  <!--end columnList-->

</scroll-view>

<view class="separate"></view>


<view class="part3">

<view class="columnList">

<text class="contact">联系信息:</text>  

<text class="contactInfo">{{item.contactInfo}}</text>      

</view>  <!--end columnList-->

</view>


<view class="part4"></view>


<view class="bar">

<view class=" rowList watcherman">

<image class="watcherimg" src="../../images/watch.png"></image>

<text class="watcher">{{watcherNum}}</text>

<button class="shareButton" id="shareBtn" open-type="share">分享</button>

</view>

</view> <!-- Bar-->


</view>




onLoad: function (options) {

var that = this;

var currentwatcherNum = 0;


if (app.globalData.glbalShowDetailJobInfo[0].watcher) {

currentwatcherNum = app.globalData.glbalShowDetailJobInfo[0].watcher;

}


var duration = 0;

var publichTime = app.globalData.glbalShowDetailJobInfo[0].date.split("-");

var curruntTime = util.formatTime(new Date()).substring(0, 10).split("/");

duration = (curruntTime[0] - publichTime[0]) * 365 + (curruntTime[1] - publichTime[1]) * 30 + (curruntTime[2] - publichTime[2]);


this.setData({

JobDescription: app.globalData.glbalShowDetailJobInfo,

watcherNum: currentwatcherNum,

normalWidth: app.globalData.globalwindowWidth - 40,

duration: duration

})


var data = this.data.JobDescription;


},



onShareAppMessage: function (options) {

if (options.from === 'button') {

// 来自页面内转发按钮  

console.log(options.target)

console.log(this.data.id) //  

}

return {

title: '    XXXX',

path: '/pages/detailedJD/detailedJD?id=' + this.data.id,

success: function (res) {

console.log("forward success")

// 转发成功

},

fail:function(res){

}

}

}


回答关注问题邀请回答
收藏

2 个回答

  • Anson
    Anson
    2018-08-02

    你好,请问最后是在onload里面获取参数的吗?

    2018-08-02
    有用
    回复
  • 东流
    东流
    2018-07-09

    .........onload里面有options可以获取到参数,你获取不到全局是因为异步加载....

    2018-07-09
    有用
    回复
登录 后发表内容