Explorar o código

fix: 解决导出图片白边的问题

奔跑的面条 %!s(int64=3) %!d(string=hai) anos
pai
achega
79a35423c7
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/utils/utils.ts

+ 3 - 1
src/utils/utils.ts

@@ -178,7 +178,9 @@ export const canvasCut = (html: HTMLElement | null, callback?: Function) => {
     return
   }
 
-  html2canvas(html).then((canvas: HTMLCanvasElement) => {
+  html2canvas(html, {
+    backgroundColor: null
+  }).then((canvas: HTMLCanvasElement) => {
     window['$message'].success('导出成功!')
     downloadByA(canvas.toDataURL(), undefined, 'png')
     if (callback) callback()