v-md-editor入门

放script setup里

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { createApp } from 'vue';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';

// highlightjs
import hljs from 'highlight.js';

VMdPreview.use(githubTheme, {
Hljs: hljs,
});

const app = createApp(/*...*/);

app.use(VMdPreview);

template里

1
<v-md-preview :text="blogText"/>