mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-09-09 16:18:10 +08:00
feat 还原代码生成器的UI 和接口格式
This commit is contained in:
16
admin/src/utils/file.ts
Normal file
16
admin/src/utils/file.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @description
|
||||
* @param file
|
||||
*/
|
||||
export function streamFileDownload(file: any, fileName = '文件名称.zip') {
|
||||
const blob = new Blob([file], { type: 'application/octet-stream;charset=UTF-8' })
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url)
|
||||
}
|
||||
Reference in New Issue
Block a user