function downloadHtml(recordData: any) {
const content = `<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>
${recordData.content}
</body>
</html>`;
const eleLink = document.createElement("a");
eleLink.download = `${recordData.noteName}.doc`;
eleLink.style.display = "none";
const blob = new Blob([content]);
eleLink.href = URL.createObjectURL(blob);
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
}
后端返回内容为富文本的下载
最新推荐文章于 2024-08-09 10:42:44 发布