http://editor.iviewui.com
iView Editor 是基于 iView 的 markdown 编辑器,支持上传图片(可集成七牛等服务),支持全屏实时编辑预览。
npm install iview-editor --save
在 webpack 中使用插件,部分代码省略:
importVuefrom'vue';importiViewfrom'iview';importiEditorfrom'iview-editor';// 使用 cssimport'iview/dist/styles/iview.css';import'iview-editor/dist/i-editor.css';// 使用插件Vue.use(iView);Vue.use(iEditor);
在 .vue 中使用:
<template><i-editorv-model="content"></i-editor></template><script>exportdefault{data(){return{content:''}}}</script>
<!DOCTYPE html><html><head><metacharset="utf-8"><title>iView Editor</title><linkrel="stylesheet"type="text/css"href="http://unpkg.com/iview/dist/styles/iview.css"><linkrel="stylesheet"type="text/css"href="http://unpkg.com/iview-editor/dist/iview-editor.css"><scripttype="text/javascript"src="http://vuejs.org/js/vue.min.js"></script><scripttype="text/javascript"src="http://unpkg.com/iview/dist/iview.min.js"></script><scripttype="text/javascript"src="http://unpkg.com/iview-editor/dist/iview-editor.js"></script></head><body><divid="app"><i-editorv-model="content"></i-editor></div><script>newVue({el:'#app',data:{content:''}})</script></body></html>