vue3渲染markdown格式数据
1.依赖
"marked": "^14.1.2",
2.示例
<template>
<div class="main">
<div v-html="renderedHtml"> </div>
</div>
</template>
<script setup>
import { marked } from 'marked';
let markdonwContent= "";
const renderedHtml = ref(marked(markdonwContent));
//追加内容
const appendMarkDownContent = (content) => {
markdonwContent+= content
renderedHtml.value = marked(markdonwContent)
}
</script>