let str = `<h1>hello world</h1>`;
const blob = new Blob([str], {
type: 'text/html'
});
let a = document.createElement('a');
a.setAttribute('download', 'a.html');
a.href = URL.createObjectURL(blob);
document.body.appendChild(a);
前端下载html
最新推荐文章于 2022-11-17 12:00:07 发布