关于uniapp使用swiper及swiper-iteam及scroll-view上下滑动及宽高问题

在uniapp中使用swiper必须要设置高度,一般都是动态设置。

一种是 高度 * 数量,这里不做详解。

另一种是 swiper + scroll-view 组合,获取系统高度 在此高度中滑动,这里要说的就是第二种。
在这里插入图片描述
swiper 绑定一个高度
在这里插入图片描述
swiper-iteam下嵌套scroll-view,并设置scroll-view的高度为100%

.scrol{
		height: 100%;
}

在js中设置swiper的高度

data(){
	return{
		swiperHeight:''
	}
}
onLoad() {
	uni.getSystemInfo({	//获取系统信息
		success: (res) => {
			this.swiperHeight = res.windowHeight + 'px'
		},
		fail: (res) => {
			console.log('error')
		}
	})
}
发布了3 篇原创文章 · 获赞 6 · 访问量 150

猜你喜欢

转载自blog.csdn.net/SupAack/article/details/104377466
今日推荐