- 主要用作关卡编辑器生成配置下载,其中存储路径为浏览器默认下载路径
- code
/**
* fileDownload
* @param content 文件内容,-str
* @param fileName 文件名,-file/level1.json
*/
downloadByBlob(content: string, fileName: string)
{
document.createElement('a');
a.href = URL.createObjectURL(
new Blob([content], { type: "application/json" })
);
a.download = fileName;
a.click();
a.remove();
URL.revokeObjectURL(a.href);
}