icssoa 8 месяцев назад
Родитель
Сommit
e2e1980752
4 измененных файлов с 653 добавлено и 624 удалено
  1. 33 0
      cool/hooks/page.ts
  2. 5 0
      pages/index/home.uvue
  3. 7 0
      types/uni-app.d.ts
  4. 608 624
      uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue

+ 33 - 0
cool/hooks/page.ts

@@ -48,6 +48,14 @@ class Page {
 	}
 
 	/**
+	 * 是否存在自定义 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();

+ 5 - 0
pages/index/home.uvue

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

+ 7 - 0
types/uni-app.d.ts

@@ -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;
 }

Разница между файлами не показана из-за своего большого размера
+ 608 - 624
uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue


Некоторые файлы не были показаны из-за большого количества измененных файлов