위챗 애플릿이 목록의 한 줄을 숨기거나 표시합니다

2218 단어
wxml

     


  
    
  
  

wxss
.text{
background-color: #eee;
padding: 5rpx;
}
/*   */
.title{
padding: 15rpx;
}
/*   */
.content{
padding: 25rpx 30rpx;
background-color: #ddd
}
.line{
border: 1rpx solid #eee;
}
.line_bottom{
border: 8rpx solid #eee;
}
/*   */
.hide{
display: none;
}
/*   */
.show{
display: block;
}

js
data: {
    list: [
      { 'id': 0, 'hidden': true },
      { 'id': 1, 'hidden': true },
      { 'id': 2, 'hidden': true },
    ],
    listCon: [
      { 'id': 0, 'hidden': true },
      { 'id': 1, 'hidden': true },
      { 'id': 2, 'hidden': true },
    ]
  },
  //    
  hiddenBtn: function (e) {
    var that = this;
    //            
    var index = e.currentTarget.dataset.index;
    //   list hidden  
    //        
    that.data.list[index].hidden = !that.data.list[index].hidden;
    that.setData({
      list: that.data.list
    })
  },
  //    
  hiddenBtnCon: function (e) {
    var that = this;
    var index = e.currentTarget.dataset.index;
    that.data.listCon[index].hidden = !that.data.listCon[index].hidden;
    that.setData({
      listCon: that.data.listCon
    })
  },

좋은 웹페이지 즐겨찾기