From a9169134d07c9f20d6abd0a9f727ec13da749711 Mon Sep 17 00:00:00 2001
From: icssoa <615206459@qq.com>
Date: Fri, 1 Aug 2025 09:56:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cool/hooks/page.ts | 6 +
pages/demo/other/cropper.uvue | 60 +-
.../components/cl-cropper/cl-cropper.uvue | 725 ++++++++++++------
.../cool-ui/components/cl-cropper/props.ts | 3 +-
uni_modules/cool-ui/types/component.d.ts | 6 +
5 files changed, 520 insertions(+), 280 deletions(-)
diff --git a/cool/hooks/page.ts b/cool/hooks/page.ts
index f08dbaf..b96618c 100644
--- a/cool/hooks/page.ts
+++ b/cool/hooks/page.ts
@@ -99,6 +99,11 @@ class Page {
* @returns 视图高度
*/
getViewHeight() {
+ // #ifdef H5
+ return uni.getWindowInfo().windowHeight;
+ // #endif
+
+ // #ifndef H5
const { screenHeight } = uni.getWindowInfo();
let h = screenHeight;
@@ -108,6 +113,7 @@ class Page {
}
return h;
+ // #endif
}
/**
diff --git a/pages/demo/other/cropper.uvue b/pages/demo/other/cropper.uvue
index 6d04384..3d7eef9 100644
--- a/pages/demo/other/cropper.uvue
+++ b/pages/demo/other/cropper.uvue
@@ -1,36 +1,43 @@
-
-
-
-
-
- 选择图片
-
+
+
+ {{ t("选择图片") }}
+
+
+
+
+
+
+
+
+
-
-
diff --git a/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue b/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue
index 303ae6c..b83e04f 100644
--- a/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue
+++ b/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue
@@ -1,64 +1,52 @@
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+ v-for="(item, index) in ['top', 'right', 'bottom', 'left']"
+ :key="index"
+ :class="`cl-cropper__mask-item cl-cropper__mask-item--${item}`"
+ :style="maskStyle[item]!"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
- 重置
-
-
- 裁剪
-
+ >
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/cool-ui/components/cl-cropper/props.ts b/uni_modules/cool-ui/components/cl-cropper/props.ts
index 12e8f2f..ebc6fd7 100644
--- a/uni_modules/cool-ui/components/cl-cropper/props.ts
+++ b/uni_modules/cool-ui/components/cl-cropper/props.ts
@@ -17,9 +17,10 @@ export type ClCropperProps = {
cropWidth?: string | number;
cropHeight?: string | number;
maxScale?: number;
- minScale?: number;
showButtons?: boolean;
quality?: number;
format?: "jpg" | "png";
disabled?: boolean;
+ canResize?: boolean; // 是否可以自定义裁剪框大小
+ canFlip?: boolean; // 是否显示翻转功能
};
\ No newline at end of file
diff --git a/uni_modules/cool-ui/types/component.d.ts b/uni_modules/cool-ui/types/component.d.ts
index d57e457..98e0c71 100644
--- a/uni_modules/cool-ui/types/component.d.ts
+++ b/uni_modules/cool-ui/types/component.d.ts
@@ -152,3 +152,9 @@ declare type ClSignComponentPublicInstance = {
clear: () => void;
toPng: () => Promise;
};
+
+declare type ClCropperComponentPublicInstance = {
+ open: (url: string) => void;
+ close: () => void;
+ chooseImage: () => void;
+};