feat:image preview component add download feature

This commit is contained in:
Hufe921
2022-06-23 20:49:04 +08:00
parent 01081ebda1
commit 08676abf05
4 changed files with 19 additions and 0 deletions
+7
View File
@@ -59,4 +59,11 @@ export function splitText(text: string): string[] {
data.push(t)
}
return data
}
export function downloadFile(href: string, fileName: string) {
const a = document.createElement('a')
a.href = href
a.download = fileName
a.click()
}