From 7dc7aaa0be474857cc3c7f2ef3b1dab056fc12c1 Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 7 Jul 2021 17:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9tinymce=E7=9A=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/marketing/coupon_edit.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/marketing/coupon_edit.vue b/src/views/marketing/coupon_edit.vue index 21bc090..210056c 100644 --- a/src/views/marketing/coupon_edit.vue +++ b/src/views/marketing/coupon_edit.vue @@ -197,6 +197,7 @@ export default class extends Vue { private dataRange: Date[] = [] private initContent = '' + private cssChanged = false get lang() { return AppModule.language @@ -344,7 +345,13 @@ export default class extends Vue { const ctx = canvas.getContext('2d') as CanvasRenderingContext2D ctx.clearRect(0, 0, canvas.width, canvas.height) var iframedoc = iframe.contentDocument || (iframe.contentWindow?.document as Document) - iframedoc.body.style.margin = '0px' + if (!this.cssChanged) { + iframedoc.body.style.margin = '0px' + var style = iframedoc.createElement('style') + style.innerHTML = 'body p { margin-block-start:0;margin-block-end:0; }' + iframedoc.head.appendChild(style) + this.cssChanged = true + } html2canvas(iframedoc.body, { canvas, useCORS: true,