安装
cnpm i markdown-it-vue
使用
<template>
<div class="md-content">
<markdown-it-vue class="md-body" :content="htmlMD"/>
</div>
</template>
<script>
import axios from 'axios';
import MarkdownItVue from 'markdown-it-vue'
import 'markdown-it-vue/dist/markdown-it-vue.css'
export default {
data(){
return {
htmlMD:""
}
},
components:{
MarkdownItVue
},
created(){
axios.get("/mdFile/aa.md").then((response) => {
this.htmlMD = response.data;
console.log(this.htmlMD)
});
}
}
</script>
<style>
</style>