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,