浏览代码

【优化】canvas 下载图片

cherishsince 1 年之前
父节点
当前提交
1b070e720d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/views/ai/image/ImageTask.vue

+ 1 - 1
src/views/ai/image/ImageTask.vue

@@ -77,7 +77,7 @@ const downloadImage = async (imageUrl) => {
     const canvas = document.createElement('canvas')
     canvas.width = image.width
     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)
     const url = canvas.toDataURL('image/png')
     const a = document.createElement('a')