Merge pull request #375 from Saibamen/format_backup_json

Format JSON file before download
This commit is contained in:
Louis Lam 2021-09-11 16:57:33 +08:00 committed by GitHub
commit 6caae725f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -383,7 +383,7 @@ export default {
notificationList: this.$root.notificationList, notificationList: this.$root.notificationList,
monitorList: monitorList, monitorList: monitorList,
} }
exportData = JSON.stringify(exportData); exportData = JSON.stringify(exportData, null, 4);
let downloadItem = document.createElement("a"); let downloadItem = document.createElement("a");
downloadItem.setAttribute("href", "data:application/json;charset=utf-8," + encodeURI(exportData)); downloadItem.setAttribute("href", "data:application/json;charset=utf-8," + encodeURI(exportData));
downloadItem.setAttribute("download", fileName); downloadItem.setAttribute("download", fileName);