diff --git a/src/assets/scripts/util.js b/src/assets/scripts/util.js index 9c2fb5f..43be7b7 100644 --- a/src/assets/scripts/util.js +++ b/src/assets/scripts/util.js @@ -235,6 +235,23 @@ export function downloadMD(doc) { document.body.removeChild(downLink); } +/** + * 导出 HTML 生成内容 + * @param {HTML生成内容} htmlStr + */ +export function exportHTML(htmlStr) { + const downLink = document.createElement('a') + + downLink.download = 'content.html'; + downLink.style.display = "none"; + let blob = new Blob([`${htmlStr}`]) + + downLink.href = URL.createObjectURL(blob); + document.body.appendChild(downLink); + downLink.click(); + document.body.removeChild(downLink); +} + /** * 生成列表字符串 * @param {*} data 对应内容集合 diff --git a/src/components/CodemirrorEditor/header.vue b/src/components/CodemirrorEditor/header.vue index 623c25e..0d47e75 100644 --- a/src/components/CodemirrorEditor/header.vue +++ b/src/components/CodemirrorEditor/header.vue @@ -22,6 +22,19 @@ @click="$emit('download')" > + + + +