diff --git a/src/components/luma/task/Preview.vue b/src/components/luma/task/Preview.vue index d0865fdd..9b866102 100644 --- a/src/components/luma/task/Preview.vue +++ b/src/components/luma/task/Preview.vue @@ -32,6 +32,16 @@ {{ $t('luma.button.extend') }} + + + {{ $t('luma.button.download') }} + +

@@ -144,6 +154,12 @@ export default defineComponent({ video_url: response.video_url }); }, + onDownload(event: MouseEvent, video_url: string) { + event.stopPropagation(); + console.log('on download'); + // download url here + window.open(video_url, '_blank'); + }, onReload(event: Event) { const target = event.target as HTMLImageElement; // append a random url query to existing url query, to force reload the image @@ -165,13 +181,6 @@ export default defineComponent({ }, onOpenVideo(url: string) { window.open(url, '_blank'); - }, - onDownload(url: string) { - // download image using javascript - const link = document.createElement('a'); - link.href = url; - link.download = url.split('/').pop() as string; - link.click(); } } }); diff --git a/src/i18n/zh-CN/luma.json b/src/i18n/zh-CN/luma.json index 6a11856f..ffe1b163 100644 --- a/src/i18n/zh-CN/luma.json +++ b/src/i18n/zh-CN/luma.json @@ -223,6 +223,10 @@ "message": "扩展视频", "description": "扩展视频按钮文本" }, + "button.download": { + "message": "下载视频", + "description": "下载视频按钮文本" + }, "button.uploadStartImageUrl": { "message": "上传图片", "description": "上传二维码的按钮文本" @@ -371,6 +375,10 @@ "message": "生成中...", "description": "图像正在生成时的消息" }, + "message.downloadVideo": { + "message": "下载此视频", + "description": "图像正在生成时的消息" + }, "message.extendVideo": { "message": "继续生成此视频", "description": "图像正在生成时的消息"