From aecf3fdb9c156e84febf143da9f5e271b32854d4 Mon Sep 17 00:00:00 2001 From: "jlj05024111@163.com" Date: Fri, 6 Dec 2024 10:30:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BE=E7=89=87=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=E9=85=8D=E7=BD=AE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=8F=82=E6=95=B0STOPPROPAGATION=EF=BC=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BAfalse=E6=97=B6=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8D=E8=BF=9B=E8=A1=8C=E9=A2=84=E8=A7=88?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=98=AF=E6=AD=A3=E5=B8=B8=E6=8A=9B=E5=87=BA?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=EF=BC=8C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BAtrue=E6=88=96=E8=80=85=E4=B8=8D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=88=99=E8=BF=98=E6=98=AF=E6=AD=A3=E5=B8=B8=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../ibiz-image-select/ibiz-image-select.tsx | 20 +++++++++++++++---- .../ibiz-image-upload/ibiz-image-upload.tsx | 18 +++++++++++++---- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08b96431..3ccee874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Change +- 图片控件支持通过配置编辑器参数STOPPROPAGATION,设置为false时点击图片不进行预览,而是正常抛出点击事件,设置为true或者不设置则还是正常预览图片 - 日历模式日期选择公共组件新增支持单个日期选择 - 多数据列表、数据视图支持字体、背景色数据项 diff --git a/src/editor/upload/ibiz-image-select/ibiz-image-select.tsx b/src/editor/upload/ibiz-image-select/ibiz-image-select.tsx index c0c23cf3..c7c75c66 100644 --- a/src/editor/upload/ibiz-image-select/ibiz-image-select.tsx +++ b/src/editor/upload/ibiz-image-select/ibiz-image-select.tsx @@ -19,6 +19,9 @@ export const IBizImageSelect = defineComponent({ const c = props.controller; + // 是否阻止默认点击 + const result = c.editorParams?.STOPPROPAGATION !== 'false'; + // svg图片内容 const svg = ref(''); @@ -36,12 +39,23 @@ export const IBizImageSelect = defineComponent({ images: files.value.map(item => item.url) as string[], }); }; + + // 图片点击 + const onClick = (file: IData, event: MouseEvent) => { + if (result) { + event.stopPropagation(); + onPreview(file); + } + }; + return { ns, c, files, svg, + result, onPreview, + onClick, }; }, render() { @@ -55,6 +69,7 @@ export const IBizImageSelect = defineComponent({ max-count={1} deletable={false} readonly + preview-full-image={this.result} {...this.$attrs} > {{ @@ -62,10 +77,7 @@ export const IBizImageSelect = defineComponent({ return (
{ - e.stopPropagation(); - this.onPreview(file); - }} + onClick={(event: MouseEvent) => this.onClick(file, event)} >
diff --git a/src/editor/upload/ibiz-image-upload/ibiz-image-upload.tsx b/src/editor/upload/ibiz-image-upload/ibiz-image-upload.tsx index 7b111503..eee04028 100644 --- a/src/editor/upload/ibiz-image-upload/ibiz-image-upload.tsx +++ b/src/editor/upload/ibiz-image-upload/ibiz-image-upload.tsx @@ -19,6 +19,9 @@ export const IBizImageUpload = defineComponent({ const c = props.controller; + // 是否阻止默认点击 + const result = c.editorParams?.STOPPROPAGATION !== 'false'; + const { uploadUrl, headers, @@ -45,6 +48,13 @@ export const IBizImageUpload = defineComponent({ }); }; + const onClick = (file: IData, event: MouseEvent) => { + if (result) { + event.stopPropagation(); + onPreview(file); + } + }; + return { ns, c, @@ -52,11 +62,13 @@ export const IBizImageUpload = defineComponent({ limit, headers, uploadUrl, + result, beforeUpload, onRemove, onPreview, afterRead, onDownload, + onClick, }; }, render() { @@ -80,6 +92,7 @@ export const IBizImageUpload = defineComponent({ before-read={this.beforeUpload} after-read={this.afterRead} before-delete={this.onRemove} + preview-full-image={this.result} {...this.$attrs} > {{ @@ -87,10 +100,7 @@ export const IBizImageUpload = defineComponent({ return (
{ - e.stopPropagation(); - this.onPreview(file); - }} + onClick={(event: MouseEvent) => this.onClick(file, event)} >
-- Gitee