微信小程序自定义顶部导航栏,动态适状态栏标题包括胶囊
创始人
2024-12-18 12:35:29
0

微信小程序自定义顶部导航栏,动态适配包括胶囊

 	 			 				 					 						哈哈哈 					 				 			 		  
menu: [], statusBarHeight: 0, //状态栏的高度  navigatorHeight: 0, //导航栏高度 menuHeight: 0, //胶囊高度 menuTop: 0, //胶囊与顶部的距离 totalHeight: 0, //总高度  onShow() { 	// 获取系统信息 	uni.getSystemInfo({ 		success: res => { 			this.system = res; 			this.statusBarHeight = this.system.statusBarHeight; // 状态栏高度 			this.calculateNavBarHeight() 		} 	}); }, methods:{ 	calculateNavBarHeight() { 		// 获取胶囊信息 		this.menu = uni.getMenuButtonBoundingClientRect(); 		// 计算组件高度 		this.menuHeight = this.menu.height; // 胶囊高度 		this.menuTop = this.menu.top; // 胶囊与顶部的距离 		// 导航栏高度= (胶囊顶部距离-状态栏高度) x 2 + 胶囊的高度 		this.navigatorHeight = (this.menu.top - this.system.statusBarHeight) * 2 + this.menu.height; 		// 总高度 = 状态栏的高度 + 导航栏高度     		this.totalHeight = this.statusBarHeight + this.navigatorHeight; 	 }, } 
	.navTitle { 		padding-left: 36rpx; 		font-family: PingFang SC, PingFang SC; 		font-weight: bold; 		font-size: 36rpx; 		color: #000000; 		margin-bottom: 10rpx; 	} 

相关内容

热门资讯

透视app!aapoker怎么... 透视app!aapoker怎么设置抽水(透视)可以开辅助器(一贯是真的有挂)一、aapoker怎么设...
透视教程!哈糖大菠萝软件下载,... 透视教程!哈糖大菠萝软件下载,wepoker脚本(透视)原先有挂(科技教程)透视教程!哈糖大菠萝软件...
透视总结(WPK)确实有挂(透... 透视总结(WPK)确实有挂(透视)wpk辅助软件(攻略方法);1、wpk辅助软件透视辅助简单,wpk...
透视挂!pokernow辅助工... 透视挂!pokernow辅助工具,哈糖大菠萝怎么挂,真是是真的有挂(攻略教程)1、任何哈糖大菠萝怎么...
透视辅助!aapoker辅助工... 透视辅助!aapoker辅助工具安全吗(透视)发牌逻辑(总是有挂)1、超多福利:超高返利,海量正版游...
透视私人局!hh poker插... 透视私人局!hh poker插件下载,约局吧德州真的有透视挂吗(透视)起初存在有挂(技巧教程)1、构...
透视透视(WPK)切实真的有挂... 透视透视(WPK)切实真的有挂(透视)wpk有作弊吗(攻略方法)1)wpk有作弊吗辅助挂:进一步探索...
透视攻略!epoker有透视吗... 透视攻略!epoker有透视吗,拱趴大菠萝机器人,其实有挂(新2025教程);1、下载好拱趴大菠萝机...
透视科技!aapoker公共底... 透视科技!aapoker公共底牌(透视)辅助器是真的(竟然是有挂)1、每一步都需要思考,不同水平的挑...
透视好友!wepoker有没有... 透视好友!wepoker有没有挂,hhpoker辅助软件(透视)起初是真的有挂(解密教程)1、hhp...