From bccb23c5598e5c26d91f7472c141953498f58663 Mon Sep 17 00:00:00 2001 From: zxc <1171051090@qq.com> Date: Fri, 14 Mar 2025 12:51:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=A1=AB=E5=85=85=E5=B1=9E=E6=80=A7=E7=9A=84?= =?UTF-8?q?=E5=BD=A2=E7=8A=B6=EF=BC=88#323=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useExport.ts | 5 +++++ src/hooks/useImport.ts | 2 +- .../components/element/ShapeElement/BaseShapeElement.vue | 2 +- src/views/components/element/ShapeElement/index.vue | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hooks/useExport.ts b/src/hooks/useExport.ts index 5c4b18f9..bac8adee 100644 --- a/src/hooks/useExport.ts +++ b/src/hooks/useExport.ts @@ -81,6 +81,11 @@ export default () => { // 格式化颜色值为 透明度 + HexString,供pptxgenjs使用 const formatColor = (_color: string) => { + if (!_color) return { + alpha: 0, + color: '#000000', + } + const c = tinycolor(_color) const alpha = c.getAlpha() const color = alpha === 0 ? '#ffffff' : c.setAlpha(1).toHexString() diff --git a/src/hooks/useImport.ts b/src/hooks/useImport.ts index 7ce3c6ff..022a5489 100644 --- a/src/hooks/useImport.ts +++ b/src/hooks/useImport.ts @@ -319,7 +319,7 @@ export default () => { top: el.top, viewBox: [200, 200], path: 'M 0 0 L 200 0 L 200 200 L 0 200 Z', - fill: fill || 'none', + fill, gradient, fixedRatio: false, rotate: el.rotate, diff --git a/src/views/components/element/ShapeElement/BaseShapeElement.vue b/src/views/components/element/ShapeElement/BaseShapeElement.vue index 11f4c918..f661616a 100644 --- a/src/views/components/element/ShapeElement/BaseShapeElement.vue +++ b/src/views/components/element/ShapeElement/BaseShapeElement.vue @@ -43,7 +43,7 @@ stroke-linecap="butt" stroke-miterlimit="8" :d="elementInfo.path" - :fill="elementInfo.gradient ? `url(#base-gradient-${elementInfo.id})` : elementInfo.fill" + :fill="elementInfo.gradient ? `url(#base-gradient-${elementInfo.id})` : (elementInfo.fill || 'none')" :stroke="outlineColor" :stroke-width="outlineWidth" :stroke-dasharray="strokeDashArray" diff --git a/src/views/components/element/ShapeElement/index.vue b/src/views/components/element/ShapeElement/index.vue index 71d7f1d8..42d057af 100644 --- a/src/views/components/element/ShapeElement/index.vue +++ b/src/views/components/element/ShapeElement/index.vue @@ -53,7 +53,7 @@ stroke-linecap="butt" stroke-miterlimit="8" :d="elementInfo.path" - :fill="elementInfo.gradient ? `url(#editabel-gradient-${elementInfo.id})` : elementInfo.fill" + :fill="elementInfo.gradient ? `url(#editabel-gradient-${elementInfo.id})` : (elementInfo.fill || 'none')" :stroke="outlineColor" :stroke-width="outlineWidth" :stroke-dasharray="strokeDashArray"