uniapp获取swiper中子组件的内容高度

swiper有默认高度,如果不单独设置一个具体高度,swiper后面的内容将不会展示

这里展示的例子是: swiper中放有一个子组件,想要完整展示子组件的内容,swiper就需要获取到子组件的内容高度并设置

html 复制代码
	<!-- 注意: 这里的单位是 px,不是rpx -->
	<swiper @change="onChangeTab" :current="navIndex" :style="'height:'+clentHeight+'px'">
		<swiper-item>
			<view class="recommend-height">
				<Recommend></Recommend>	
			</view>
		</swiper-item>		
	</swiper>
javascript 复制代码
// 获取swiper内容的整体高度 
 onReady() { 
	let view = uni.createSelectorQuery().select('.recommend-height')
	view.boundingClientRect((data) => {
		this.clentHeight = data.height
		console.log(data.height)
	}).exec()
 },
相关推荐
码兄科技1 天前
24小时自助健身房系统软件开发实战指南:功能设计与部署方案
java·spring boot·uni-app
2501_916007471 天前
苹果商店iOS应用上架费用全面解析:开发者计划与审核费用计算
android·ios·小程序·https·uni-app·iphone·webview
2501_916008891 天前
如何实现iOS App代码混淆:SwiftShield使用指南
android·ios·小程序·https·uni-app·iphone·webview
2501_916008892 天前
怎么用 Godot 导出 iOS 应用并上架 App Store?签名字段该填什么?
android·ios·小程序·https·uni-app·iphone·webview
郑州光合科技余经理2 天前
同城外卖小程序开发:下单成功后,后台导出能不能对上用户端状态
开发语言·前端·git·后端·uni-app·php·ai编程
白远山3 天前
城市电竞陪玩调度系统实战:从派单算法到多端协同的架构拆解
java·架构·uni-app·需求分析
白远山3 天前
上海24小时自助健身房系统软件开发实战指南
java·架构·uni-app·需求分析
白远山4 天前
上海24小时自助健身房系统软件开发实战指南:从需求到部署
java·架构·uni-app·需求分析
海鸥两三5 天前
小程序文档预览 · 进阶面试题
小程序·uni-app·uniapp
海鸥两三5 天前
微信小程序 PDF 预览实践(uni.downloadFile → uni.openDocument)
小程序·uni-app