wxml
<navigator bindtap=\'share\' hover-class="none"> <view class=\'\'>分享乐活 <image class=\'fr\' src=\'/img/arrorw.png\'></image> </view> </navigator> <view class=\'share\' wx:if="{{shareshow}}"> <view class=\'shareTo\'> <view class=\'line\'></view> <view class=\'to\'>分享到</view> <view class=\'line\'></view> </view> <button open-type="share" hover-class="none"> <image src="/img/wechat.png" class=\'wechat\'></image> <view class=\'\'>微信好友</view> </button> </view>
wxjs
// pages/set/set.js Page({ data: { shareshow: false }, onLoad: function(options) { }, onShow: function() { }, share:function(){ var that = this; var shareshow = that.data.shareshow that.setData({ shareshow: !that.data.shareshow }) }, onShareAppMessage: function (res) { if (res.from === \'button\') { } return { title: \'分享\', path: \'/pages/index/index\', success: function (res) { console.log(\'成功\', res) } } } })