更新依赖,增加 mavon-editor

This commit is contained in:
hooray
2021-11-19 17:46:49 +08:00
parent a322dd4415
commit 93dd7a0704
3 changed files with 71 additions and 34 deletions
@@ -1,23 +1,27 @@
<template>
<div>
<page-main title="富文本编辑器">
<editor v-model="form.content" />
<div class="preview" v-html="form.content" />
<editor v-model="content1" />
<div class="preview" v-html="content1" />
</page-main>
<page-main title="markdown 编辑器">
<mavon-editor v-model="content2" style="z-index: 9;" />
<div class="preview" v-html="mdContent2" />
</page-main>
</div>
</template>
<script>
export default {
name: 'ComponentExampleEditor',
data() {
return {
form: {
content: '<h1>Fantastic-admin</h1>'
}
}
}
}
<script setup>
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
const content1 = ref('<h1>Fantastic-admin</h1>')
const content2 = ref('# Fantastic-admin')
const mdContent2 = computed(() => {
const mdit = mavonEditor.getMarkdownIt()
return mdit.render(content2.value)
})
</script>
<style lang="scss" scoped>