Browse Source

添加获取系统信息js,用于设置全局属性

htc 1 year ago
parent
commit
3eac763f3a
1 changed files with 18 additions and 0 deletions
  1. 18 0
      utils/getSystemInfo.js

+ 18 - 0
utils/getSystemInfo.js

@@ -0,0 +1,18 @@
+export default {
+	data() {
+		return {
+			h:uni.getSystemInfoSync().windowHeight,//屏幕高度
+			mt:uni.getSystemInfoSync().statusBarHeight + 44,//自定义头部组件高度(使用自定义头部组件的上边距)
+			th:50+uni.getSystemInfoSync().safeAreaInsets.bottom//底部tabbar高度
+		}
+	},
+	onShow(){
+		uni.getSystemInfo({
+			success:res=>{
+				if(res.platform === 'android'){
+					this.th = res.screenHeight - res.windowHeight - res.statusBarHeight - 48;
+				}
+			}
+		})
+	}
+}