Remove JSON download functionality from App.vue and implement it in parent.html

This commit is contained in:
HoshinoKoji 2025-03-03 19:40:41 +08:00
parent 1341a32484
commit e0954a34e7
2 changed files with 5 additions and 6 deletions

View File

@ -48,7 +48,10 @@
}] }]
}; };
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
console.log(event.data); const elem = document.createElement('a');
elem.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(event.data));
elem.download = 'results.json';
elem.click();
}); });
window.onload = () => { window.onload = () => {
const iframe = document.getElementById('iframe'); const iframe = document.getElementById('iframe');
@ -64,7 +67,7 @@
</head> </head>
<body> <body>
<iframe <iframe
src="/index.html" src="index.html"
style="width: 99vw; height: 95vh; border: none;" style="width: 99vw; height: 95vh; border: none;"
id="iframe"></iframe> id="iframe"></iframe>
</body> </body>

View File

@ -162,10 +162,6 @@ export default {
ended: new Date().getTime(), ended: new Date().getTime(),
results results
}, window.origin); }, window.origin);
const elem = document.createElement('a');
elem.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(results));
elem.download = 'results.json';
elem.click();
} }
} }
} }