![微信小程序 swiper 组件坑 微信小程序 swiper 组件坑](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
swiper 组件高度被限制为150px了,所以内容无法撑开。
解决办法
给这组件重新设置个高度,然后在把里面的图片设置为自动适应容器大小。图片模式设置为 宽度不变 自动适应高度
<swiper class="test" .....>
<swiper-item>
<image mode='widthFix' ...... />
</swiper-item>
</swiper> <style>
.text{
height:200px;
}
image{
width:100%;
height:auto;
}
</style>