小程序之按钮点击之后,显示和隐藏切换

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)
      }
    }
  } 
})

 

posted @ 2019-04-30 13:35  bingxiaoxiao  阅读(9540)  评论(0编辑  收藏  举报