微信小程序循环不同列表实现动态点击隐藏

wxml


				
				
					
						
						{{item.name}}
						储蓄卡
					
				
				
				
					
						
						原始:¥665556 
					
					
						
						普通:¥66556 
					
					
						
						VIP:¥55555 
					
				
				
				
					
						
						
							
							分享获得佣金 100%
						
					
					
						
							
							返现金额 普通会员:20%  VIP会员:20% 
						
					
					
						
							
							VIP会员可自定义储值卡金额
						
					
				
				
					
						
						
							收起
							
						
						
							查看详情
							
						
					
				
			

js中

data:{
 search: [{
      name: "海南省",
      id: "1",
    }, {
      name: "河南",
      id: "2",
    }]
}
listToggle(e) {
    let index = 0;
    let array= this.data.search; //获取循环数组对象
    for (let item of array) {
      if (item.id == e.currentTarget.dataset.id) {
        if (array[index].editTrue == "" || array[index].editTrue == undefined) {
          array[index].editTrue = "true"
          //array[index].showMore = "false"
        } else {
          arrayItem[index].editTrue = ""
         // arrayItem[index].showMore = ""
        }
      }
      index++;
    }
    this.setData({
      search: array
    })
  },

wxss

/*  */
.isRuleShow {
  display: none;

}

.isRuleHide {
  display: block;
}

你可能感兴趣的:(微信小程序循环不同列表实现动态点击隐藏)