现在我用swiper做一些tab切换时,swiper的高度固定是150px,但是我的swiper-item里面内容的高度有时不止150px,我设置min-height是没有效果的,但是把swiper的高度设置为一个固定的死数据又不好,所以请官方能否让swiper 的高度变得可以自适应,谢谢!
< swiper wx:for='{{array}}' style = 'height:{{ heights[index] || 50 }}px' >
< swiper-item >
< view class = 'getThisHeight' >
...这里放自适应内容
</ view >
</ swiper-item >
</ swiper >
justifyHeight: function () {
let that = this
let hs = []
wx.createSelectorQuery().selectAll( '. getThisHeight ' ).boundingClientRect( function (rects) {
rects.forEach((v, i) => {
hs[i] = v.height
})
that.setData({
heights: hs,
})
}).exec()
},