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

时间:2019-04-30 14:01:15   收藏:0   阅读:847

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

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!