swiper用flex:1来适应高度时,swiper-item高度继承默认150
代码大概如下
< view class = "container" > < view class = "nav" ></ view > < swiper class = "swiper" > < swiper-item ></ swiper-item > </ swiper > </ view > |
.container { width : 100% ; height : 100% ; display : flex; flex- direction : column; justify- content :flex-start; } .nav { width : 100% ; min-height : 160 rpx; } .swiper { flex: 1 ; } |
然后swiper-item的高度100%就是默认的150px了,无法做到自适应。这情况只在ios出现,android并不会。