晓包
晓包
  • 发布:2023-09-28 11:38
  • 更新:2023-09-28 18:03
  • 阅读:100

swiper组件,纵向滚动,第一页高度不定,之后页面高度是屏高,怎么设置

分类:uni-app

swiper组件,纵向滚动,第一页高度不定,之后页面高度是屏高,怎么设置

2023-09-28 11:38 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

可以根据current 去动态设置高度

<swiper class="swiper" :vertical="true"  @change="change" :style="{'height':current == 0?height:'100vh'}">  
    <swiper-item v-for="(item,index) in background" :key="index" >  
        <view class="swiper-item uni-bg-red" :style="{'height':height}">A{{index}}</view>  
    </swiper-item>  
</swiper>  

data() {  
    return {  

        height:'500px',  
        current:0  
    }  
},  

methods:{  
        change(event){  
            this.current = event.detail.current  
            console.log(event.detail.current)  
    },  
}  

要回复问题请先登录注册