写在前面:
关于mavonEditor文章的保存,我保存了content和html。
基本思路是在普通阅读时利用v-html去显示axios请求到的数据库里面保存的html;而在编辑情况,则仿照新增文档时,用v-model绑定content,然后通过axios请求到数据库保存的content和html,再将它们分别赋值给Vue中的content和html,即可实现编辑回显功能。
普通阅读:
<!-- 文章内容块 -->
<article>
<div style="padding:20px" v-highlight>
<h1 class="blog-title" v-text="Blog.title"></h1>
<!-- 用<mavon-editor>标签显示文章内容 -->
<mavon-editor v-html="Blog.html" style="padding:20px">
</mavon-editor>