最近做小程序的时候遇到了swiper高度的问题,swiper里面的内容可以根据数据来自适应高度。那就给scroll-view计算一下高度
wxml
<view class="container1">
<!-- tab切换 -->
<view class="tab">
<scroll-view scroll-x="true" class="nav" scroll-left="{
{navScrollLeft}}" scroll-with-animation="{
{true}}">
<block wx:for="{
{nav}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="nav-item {
{currentTab == index ?'active':''}}" data-current="{
{index}}" bindtap="switch">{
{item.text}}</view>
</block>
</scroll-view>
</view>
<!-- 内容-->
<swiper class="" current="{
{currentTab}}" duration="300" bindchange="switchTab" style='height:{