uni-app 获取可用屏幕宽度,高度

 

let systemInfo = uni.getSystemInfoSync()
			// px转换到rpx的比例
			let pxToRpxScale = 750 / systemInfo.windowWidth;
			// 状态栏的高度
			let ktxStatusHeight = systemInfo.statusBarHeight * pxToRpxScale
			// 导航栏的高度
			let navigationHeight = 44 * pxToRpxScale
			// window的宽度
			let ktxWindowWidth = systemInfo.windowWidth * pxToRpxScale
			// window的高度
			let ktxWindowHeight = systemInfo.windowHeight * pxToRpxScale
			// 屏幕的高度
			let ktxScreentHeight = systemInfo.screenHeight * pxToRpxScale
			// 底部tabBar的高度
			let tabBarHeight = ktxScreentHeight - ktxStatusHeight - navigationHeight - ktxWindowHeight

 

上一篇:uni-app图片本地路径/网络路径转base64流 压缩


下一篇:uni-app接入极光推送