From a6d52398553f3185fa77a4fff7e3df4be4b058c1 Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Tue, 1 Sep 2020 15:30:40 +0800 Subject: [PATCH] png transparent --- src/utils/downloader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/downloader.js b/src/utils/downloader.js index b19da31..cbbd01c 100644 --- a/src/utils/downloader.js +++ b/src/utils/downloader.js @@ -44,8 +44,8 @@ export function saveImg(value, content, width, height, type) { return new Promise(resolve => { img.onload = () => { - ctx.fillStyle = 'white' - ctx.fillRect(0, 0, width, height) + ctx.fillStyle = 'white'; + if (type === 'jpg') ctx.fillRect(0, 0, width, height); ctx.drawImage(img, 0, 0, width, height); // `download` attr is not well supported // Will result in a download popup for chrome and the