Vditor
## 官方地址 *https://b3log.org/vditor/* ## 安装 ``` npm install vditor --save ``` ## 快速使用 ### 浏览 ``` <template> <div id="app"> <div id="preview"></div> </div> </template> <script> import Vditor from 'vditor' import "vditor/src/assets/less/index.less" export default { name: 'App', mounted() { this.initPreview() }, methods: { initPreview() { Vditor.preview(document.getElementById('preview'), "Hello, Vditor!", {}); } } } </script> ``` ### 编辑 ``` <template> <div id="app"> <div id="editor"></div> </div> </template> <script> import Vditor from 'vditor' import "vditor/src/assets/less/index.less" export default { name: 'App', data() { return { vditor: null } }, mounted() { this.initVditor() }, methods: { initVditor() { this.vditor = new Vditor('editor', { height: '100%', placeholder: '请输入内容', preview: { hljs: { style: 'github' }, markdown: { toc: true } }, toolbarConfig: { pin: true }, value: 'Hello, Vditor!' }) } } } </script> ```
创建时间:2024-04-14
|
最后修改:2024-04-14
|
©允许规范转载
酷酷番茄
首页
文章
友链