3 :/**
-
浏览器导出json文件
-
@param textToWrite
-
@param fileNameToSaveAs
*/
private saveForBrower(textToWrite: string, fileNameToSaveAs: string) {
if (cc.sys.isBrowser) {
var textFileAsBlob = new Blob([textToWrite], {
type: “application/json”
});
var downloadLink = document.createElement(“a”);
downloadLink.download = fileNameToSaveAs || “”;
downloadLink.innerHTML = “Download File”;
if (webkitURL != null) {
downloadLink.href = webkitURL.createObjectURL(textFileAsBlob);
} else {
downloadLink.href = URL.createObjectURL(textFileAsBlob);
downloadLink.style.display = “none”;
document.body.appendChild(downloadLink);
}downloadLink.click();
}
}

这就不清楚了。。。