优化
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -362,6 +362,11 @@ const data = computed<Item[]>(() => {
|
||||
icon: "sketching",
|
||||
path: "/pages/demo/other/sign"
|
||||
},
|
||||
{
|
||||
label: "图片裁剪",
|
||||
icon: "crop-line",
|
||||
path: "/pages/demo/other/cropper"
|
||||
},
|
||||
{
|
||||
label: "DayUts",
|
||||
icon: "timer-2-line",
|
||||
|
||||
7
types/uni-app.d.ts
vendored
7
types/uni-app.d.ts
vendored
@@ -198,6 +198,13 @@ declare interface UniMouseEvent extends UniEvent {
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare interface UniImageLoadEvent extends UniEvent {
|
||||
detail: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
}
|
||||
|
||||
declare interface JSON {
|
||||
parseObject<T>(text: string): T | null;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user