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; return false;
} }
/**
* 是否存在自定义 topbar
* @returns boolean
*/
hasCustomTopbar() {
return router.route()?.isCustomNavbar ?? false;
}
/** /**
* 获取 tabBar 高度 * 获取 tabBar 高度
* @returns tabBar 高度 * @returns tabBar 高度
@@ -85,6 +93,31 @@ class Page {
return h; 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(); export const page = new Page();

View File

@@ -362,6 +362,11 @@ const data = computed<Item[]>(() => {
icon: "sketching", icon: "sketching",
path: "/pages/demo/other/sign" path: "/pages/demo/other/sign"
}, },
{
label: "图片裁剪",
icon: "crop-line",
path: "/pages/demo/other/cropper"
},
{ {
label: "DayUts", label: "DayUts",
icon: "timer-2-line", icon: "timer-2-line",

7
types/uni-app.d.ts vendored
View File

@@ -198,6 +198,13 @@ declare interface UniMouseEvent extends UniEvent {
y: number; y: number;
} }
declare interface UniImageLoadEvent extends UniEvent {
detail: {
width: number;
height: number;
};
}
declare interface JSON { declare interface JSON {
parseObject<T>(text: string): T | null; parseObject<T>(text: string): T | null;
} }

File diff suppressed because it is too large Load Diff