mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-08-04 13:14:07 +08:00
【优化】canvas 下载图片
This commit is contained in:
@@ -77,7 +77,7 @@ const downloadImage = async (imageUrl) => {
|
|||||||
const canvas = document.createElement('canvas')
|
const canvas = document.createElement('canvas')
|
||||||
canvas.width = image.width
|
canvas.width = image.width
|
||||||
canvas.height = image.height
|
canvas.height = image.height
|
||||||
const ctx = canvas.getContext('2d')
|
const ctx = canvas.getContext('2d') as CanvasDrawImage
|
||||||
ctx.drawImage(image, 0, 0, image.width, image.height)
|
ctx.drawImage(image, 0, 0, image.width, image.height)
|
||||||
const url = canvas.toDataURL('image/png')
|
const url = canvas.toDataURL('image/png')
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
|
Reference in New Issue
Block a user