feat: 解析md显示,js模块化
parent
ef595d195a
commit
834cdfdf6e
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
@ -0,0 +1,24 @@
|
|||||||
|
<template>
|
||||||
|
<el-card>
|
||||||
|
<img src="./img/1.png" />
|
||||||
|
<div
|
||||||
|
class="md-main"
|
||||||
|
v-html="htmlStr"
|
||||||
|
></div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { marked } from 'marked';
|
||||||
|
|
||||||
|
const htmlStr = ref('');
|
||||||
|
|
||||||
|
fetch('./summer.md', {
|
||||||
|
method: 'GET',
|
||||||
|
}).then((result) => {
|
||||||
|
result.text().then((res) => {
|
||||||
|
htmlStr.value = marked(res);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue