This commit is contained in:
icssoa
2025-07-31 19:11:13 +08:00
parent 4c5677e75f
commit e2e1980752
4 changed files with 709 additions and 680 deletions

View File

@@ -47,6 +47,14 @@ class Page {
return false;
}
/**
* 是否存在自定义 topbar
* @returns boolean
*/
hasCustomTopbar() {
return router.route()?.isCustomNavbar ?? false;
}
/**
* 获取 tabBar 高度
* @returns tabBar 高度
@@ -85,6 +93,31 @@ class Page {
return h;
}
/**
* 获取视图高度
* @returns 视图高度
*/
getViewHeight() {
const { screenHeight } = uni.getWindowInfo();
let h = screenHeight;
if (!this.hasCustomTopbar()) {
h -= 44 + this.getSafeAreaHeight("top");
}
return h;
}
/**
* 获取视图宽度
* @returns 视图宽度
*/
getViewWidth() {
const { screenWidth } = uni.getWindowInfo();
return screenWidth;
}
}
export const page = new Page();