feat 还原代码生成器的UI 和接口格式

This commit is contained in:
damonyuan
2024-10-19 23:43:19 +08:00
parent 74a57c9543
commit f0451376f9
12 changed files with 439 additions and 397 deletions

16
admin/src/utils/file.ts Normal file
View 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)
}