王多静

这里是我的记事本

导航

小程序的点击折叠隐藏显示

wxml:

<icon class="iconfont icon-dayuhao" bindtap='showHide'>折叠按钮</icon>
<view class="inforlist {{showView?'show':'hide'}}">
  折叠的列表内容
</view>

 

wxss:

.show{
  display: block;
}
.hide{
  display: none;
}

 

js全贴:

// pages/sendinfor/sendinfor.js
Page({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    showView: true
  },

  /**
   * 组件的方法列表
   */
  methods: {

  },
  onload:function(options){
    //生命周期函数--监听页面加载
    showView:(options.showView == 'true'? true:false)
  },
  showHide: function(){
    var that = this;
    that.setData({
      showView:(!that.data.showView)
    })
  }
})

 

posted on 2018-08-29 19:35  王多静  阅读(264)  评论(0)    收藏  举报