<view class="txtshow" wx:for="{{list}}">
<view id="frame{{index}}" class="cyytxt {{item.isShow ? 'nofold':''}}">
<text id="content{{index}}">{{item.txt}}</text></view>
<image src="{{item.isShow?'/images/up_arrow.png':'/images/Down_arrow.png'}}" class="sq" bindtap="click" data-id="{{index}}"></image>
</view>
click:function(e){
var query = wx.createSelectorQuery();
let that = this
var index=e.currentTarget.dataset.id
let currect = "list["+index+"].isShow"
query.select('#content'+index).boundingClientRect();
query.select('#frame'+index).boundingClientRect();
query.exec(function (res) {
if (res[0] && res[0].height) {
if (res[0].height > res[1].height) {
that.setData({
[currect]: true
});
} else {
that.setData({
[currect]: false
});
}
}
})
},
网友评论