From 99336d1128a809f2b3ec4d6edc3255051f31b4d4 Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Tue, 11 Feb 2025 13:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=88=91=E5=BE=97=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0handleWH?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E4=B8=BAfalse=E5=88=99=E4=BC=A0?= =?UTF-8?q?=E5=A4=9A=E5=B0=91=E5=AE=BD=E9=AB=98=EF=BC=8C=E6=9C=80=E7=BB=88?= =?UTF-8?q?=E8=A3=81=E5=89=AA=E5=90=8E=E7=9A=84=E5=AE=BD=E9=AB=98=E5=B0=B1?= =?UTF-8?q?=E6=98=AF=E5=A4=9A=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jp-cropper-watermark/jp-cropper-watermark.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/uni_modules/jp-cropper-watermark/components/jp-cropper-watermark/jp-cropper-watermark.vue b/uni_modules/jp-cropper-watermark/components/jp-cropper-watermark/jp-cropper-watermark.vue index db05762..0c0acb0 100644 --- a/uni_modules/jp-cropper-watermark/components/jp-cropper-watermark/jp-cropper-watermark.vue +++ b/uni_modules/jp-cropper-watermark/components/jp-cropper-watermark/jp-cropper-watermark.vue @@ -45,6 +45,7 @@ * @property {String} url 图片路径 * @property {Number} width 宽度 * @property {Number} height 高度 + * @property {boolean} handleWH 是否对宽高进行逻辑处理 false:宽高传多少用多少 * @property {Number} maxWidth 最大宽带 * @property {Number} minHeight 最大高度 */ @@ -66,6 +67,10 @@ export default { type: Number, default: 200 }, + handleWH: { + type: Boolean, + default: true + }, maxWidth: { type: Number, default: 1024 @@ -351,6 +356,7 @@ export default { destWidth: mx.tw, destHeight: mx.th, success: (rst) => { + console.log(rst) var path = rst.tempFilePath; // #ifdef H5 var base64 = path; @@ -470,16 +476,16 @@ export default { if (this.rotate % 180 != 0) { mul = this.image.height / this.real.width; } - if (this.mode != "fixed") { + if (this.mode != "fixed" && this.handleWH) { width = this.frame.width / mul; height = this.frame.height / mul; } var rate = width / height; - if (width > this.maxWidth) { + if (width > this.maxWidth && this.handleWH) { width = this.maxWidth; height = width / rate; } - if (height > this.maxHeight) { + if (height > this.maxHeight && this.handleWH) { height = this.maxHeight; width = height * rate; }