让我们用mavon-editor开发博客系统
来源:互联网 发布:本田凌派maf标准数据 编辑:程序博客网 时间:2024/06/05 18:39
mavon-editor的安装
npm install mavon-editor --save
import mavonEditor from 'mavon-editor' import 'mavon-editor/dist/css/index.css'Vue.use(mavonEditor)
mavon-editor的使用
<mavon-editor @imgAdd='editorUpdataImgs' v-model="article.content"/>
editorUpdataImgs(filename,file){ //上传图片 var formData = new FormData(); formData.append('file', file,file.name); let config = { headers:{'Content-Type':'multipart/form-data'}, emulateJSON:true }; this.$http.post(servicePath +'uplode/userHead',formData,config).then(function(response){ if (response.body.message) { this.$refs.editor.$img2Url(filename,response.body.data);//更改图片内文章上传地址 }else{ } },function(response){ this.$message.error('抱歉!图片上传失败!请来联系管理员'); });}
使用marked将markdown语法解析成html并且高亮代码
安装marked插件
npm install marked --save
var renderer = new marked.Renderer();
安装highlight.js
import highlightJs from 'highlight.js';
开始使用
marked.setOptions({ highlight: (code) => highlightJs.highlightAuto(code).value })
渲染数据
let highlight_code = marked(response.body.data.content) this.message_text = highlight_code;
转载自 我的博客-九零码农
阅读全文
0 0
- 让我们用mavon-editor开发博客系统
- Blogger,博客,让我们开打
- 让我们开始用GPHONE!Android开发初试
- 用Django来开发博客系统
- 用Django来开发博客系统
- 博客系统的开发
- 老田让我们写博客
- 用Eclipse Visual Editor 开发SWT GUI
- 用Eclipse Visual Editor 开发SWT GUI
- JSP~Qing博客系统开发
- 个人博客系统的开发
- Flask开发多博客系统
- 教学管理系统-Editor实现
- django 个人博客系统开发 - 开发流程
- 【写漂亮的博客】让我们的博客更加漂亮,让我们的博客支持响应式布局!
- 让我们用中文编程
- 让我们用螃蟹告别
- 让我们用中文编程
- 【BZOJ1060】【ZJOI2007】时态同步
- 读书笔记∣商务与经济统计Ch.1-3
- 170909 WarGames-Utumno(0-1)
- mysql innoDB的REPEATABLE READ MVCC事务实现方式
- html与css第三天
- 让我们用mavon-editor开发博客系统
- PAT乙级1059. C语言竞赛(20)
- Ubuntu 16.04下安装VMware Tools(三行命令搞定)
- CC2530裸机编程-定时器1
- 漫无目的的来到北京(求职路一)
- 自定义一个死锁
- 算法 第四版 动画 2.1.17
- 栈溢出笔记1.1 函数调用过程
- SVN的命令行操作、图形界面TortoiseSVN操作