From 083c8b1325222d344204dabda9d17dd6dd01ffc2 Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Thu, 4 Sep 2025 10:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20ios=20=E7=AB=AF=20cl-cropp?= =?UTF-8?q?er=20=E9=AB=98=E5=92=8C=E5=AE=BD=E4=B8=BA0=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=20load=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/cl-cropper/cl-cropper.uvue | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) 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 98a0e3d..a2a45b6 100644 --- a/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue +++ b/uni_modules/cool-ui/components/cl-cropper/cl-cropper.uvue @@ -12,7 +12,12 @@ { const flipX = flipHorizontal.value ? "scaleX(-1)" : "scaleX(1)"; const flipY = flipVertical.value ? "scaleY(-1)" : "scaleY(1)"; + let height = toPixel(imageSize.height); + let width = toPixel(imageSize.width); + + // 解决 ios 端高和宽为0时不触发 load 事件 + if (height == 0) { + height = 1; + width = 1; + } + // 创建基础样式对象 const style = { transform: `translate(${toPixel(transform.translateX)}px, ${toPixel(transform.translateY)}px) ${flipX} ${flipY} rotate(${rotate.value}deg)`, // 设置图片位移和翻转变换 - height: toPixel(imageSize.height) + "px", // 设置图片显示高度 - width: toPixel(imageSize.width) + "px" // 设置图片显示宽度 + height: height + "px", // 设置图片显示高度 + width: width + "px", // 设置图片显示宽度 + opacity: height == 0 ? 0 : 1 // 设置图片显示透明度 }; - // 如果不在触摸状态,添加过渡动画 - if (!touch.isTouching) { - style["transitionDuration"] = "0.3s"; // 设置过渡动画时长 - } - // 返回样式对象 return style; }); @@ -1192,7 +1202,17 @@ defineExpose({ z-index: 510; &__image { - @apply absolute top-0 left-0 flex items-center justify-center w-full h-full pointer-events-none; + @apply absolute top-0 left-0 flex items-center justify-center w-full h-full; + @apply pointer-events-none; + + &-inner { + @apply transition-none; + + .no-dragging { + @apply duration-300; + transition-property: transform; + } + } } &__mask {