Vue3 中使用 markdown编辑器和展示
import { createApp } from 'vue'import ElementPlus from 'element-plus';import 'element-plus/lib/theme-chalk/index.css';import App from './App.vue';import router from './router/index';import Axios from
·
import { createApp } from 'vue'
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
import App from './App.vue';
import router from './router/index';
import Axios from 'axios';
import VueMarkdownEditor from '@kangc/v-md-editor';
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/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';
VueMarkdownEditor.use(vuepressTheme);
VMdPreview.use(githubTheme);
const app = createApp(App);
app.config.globalProperties.$axios = Axios; // this.Axios
app.use(ElementPlus);
app.use(VueMarkdownEditor);
app.use(VMdPreview);
app.use(router);
app.mount('#app');
推荐使用v-md-editor,Vue3中不能使用mavon-editor,因其无3版本正在开发中。
v-md-editor官方文档::https://ckang1229.gitee.io/vue-markdown-editor/zh/examples/preview-demo.html#%E5%BC%95%E5%85%A5
公众号:CS阿吉
更多推荐
已为社区贡献8条内容
所有评论(0)