微信小程序点击右上角胶囊分享动态获取title
时间:2020-09-17 17:40:22
收藏:0
阅读:63
wxml:(父级页面)
<view class="pageLi flex" catchtap="toInstitute" data-name="{{item.shop_name}}" data-id="{{item.id}}">
<image src=‘{{item.headimg}}‘ mode=‘aspectFill‘></image>
<view class="pagePre sub">
<text class="tit f32">{{item.shop_name}}</text>
<view class="page_text flex">
<text wx:for="{{item.sports}}" wx:if="{{idx<4}}" wx:for-index="idx" wx:for-item="item2">{{item2.sport_name}}</text>
</view>
<text class="phone">联系电话:{{item.phone}}</text>
<text class="add">浏览:{{item.sort}}</text>
<text class="add">{{item.address}}</text>
</view>
</view>
wxjs:(父级页面)
toInstitute: function(e) { let share_title=e.currentTarget.dataset.name let id = e.currentTarget.dataset.id wx.navigateTo({ url: ‘/pages/newPage/institute/index?share_title=‘ + share_title + ‘&id=‘ + id }) },
wxjs:(子页面)
data: { id: 0, shareTitle:‘‘ }, onLoad: function (options) { this.data.id = options.id this.data.shareTitle=options.share_title console.log(this.data.shareTitle) console.log(options.share_title) } /** * 用户点击右上角分享 */ onShareAppMessage: function (options) { console.log(options.share_title) // 用户点击了“转发”按钮 return { title: this.data.shareTitle } },
评论(0)