点击/滑动的页面切换效果,可以使用swiper来实现,但是swiper默认高度为150,不会自适应高度,所以当页面数据过多,超过页面可视区域,会导致页面无法上下滑动的情况
解决办法:使用scroll-view包裹页面元素,并且动态设置swiper的高度,让其根据内容的高度自适应
<view class="item">
<view class="item-list {
{
currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="switchNav">表白墙</view>
<view class="item-list {
{
currentTab==1 ? 'on' : ''}}" data-current="1" bindtap="switchNav">找对象</view>
</view>
<!-- 对应内容切换 -->
<swiper style="height: {
{
wHeight ? wHeight + 'px' : auto}}" current="{
{
currentTab}}" duration="300" bindchange="bindChange">
<swiper-item>
<scroll-view scroll-y="{