小程序 点击切换

  

  itemidClicked: function(e) {
    var v = e.currentTarget.dataset.itemid
    if (v != itemidClicked) {
      itemidToggle = true
    } else {
      itemidToggle = !itemidToggle
    }
    itemidClicked = v
    var that = this;
    that.setData({
      itemidClicked: itemidClicked,
      itemidToggle: itemidToggle
    });

  },
  
  
  
  
  
      <view wx:for="{{item.medias}}" style="display:{{item.package_id===itemidClicked && itemidToggle ? 'block':'none'  }}" wx:for-item="itemsSecond">
        {{itemsSecond.media_name}}{{itemsSecond.media_id}}
      </view>

  

 

posted @ 2018-07-27 22:55  papering  阅读(199)  评论(0编辑  收藏  举报