From 56fadef948a7160feb79a22d4c1ccbaa829cb524 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sat, 30 Apr 2022 20:06:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BE=E8=A1=A8=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=9B=BE=E7=89=87=E5=90=8E=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=88#98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useExport.ts | 12 +++--------- .../element/ChartElement/BaseChartElement.vue | 18 +++++++++++------- .../ChartElement/ScreenChartElement.vue | 6 +----- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/hooks/useExport.ts b/src/hooks/useExport.ts index 4a84bd04..0c42081d 100644 --- a/src/hooks/useExport.ts +++ b/src/hooks/useExport.ts @@ -16,7 +16,6 @@ import { message } from 'ant-design-vue' interface ExportImageConfig { quality: number; width: number; - filter: (node: HTMLElement) => boolean; fontEmbedCSS?: string; } @@ -30,18 +29,13 @@ export default () => { exporting.value = true const toImage = format === 'png' ? toPng : toJpeg + const foreignObjectSpans = domRef.querySelectorAll('foreignObject [xmlns]') + foreignObjectSpans.forEach(spanRef => spanRef.removeAttribute('xmlns')) + setTimeout(() => { - if (!domRef) return - - const filter = (node: HTMLElement) => { - if (node.tagName && node.tagName.toUpperCase() === 'FOREIGNOBJECT') return false - return true - } - const config: ExportImageConfig = { quality, width: 1600, - filter, } if (ignoreWebfont) config.fontEmbedCSS = '' diff --git a/src/views/components/element/ChartElement/BaseChartElement.vue b/src/views/components/element/ChartElement/BaseChartElement.vue index ffca87c6..cbd3219d 100644 --- a/src/views/components/element/ChartElement/BaseChartElement.vue +++ b/src/views/components/element/ChartElement/BaseChartElement.vue @@ -40,8 +40,9 @@