# Vue-SimpleMDE
> Markdown Editor component for Vue.js. Support only vue2.x.
[![npm package](https://img.shields.io/npm/v/vue-simplemde.svg)](https://npmjs.org/package/vue-simplemde)
[![npm downloads](http://img.shields.io/npm/dm/vue-simplemde.svg)](https://npmjs.org/package/vue-simplemde)
# Use Setup
> No longer support Vue1.x, you can modify to use
## Install
``` bash
npm install vue-simplemde --save
```
## Use
* Internal reference in a single component
``` vue
<template>
<vue-simplemde v-model="content" ref="markdownEditor" />
</template>
<script>
import VueSimplemde from 'vue-simplemde'
export default {
components: {
VueSimplemde
}
}
</script>
<style>
@import '~simplemde/dist/simplemde.min.css';
</style>
```
* Global reference
``` javascript
import Vue from 'vue'
import VueSimplemde from 'vue-simplemde'
import 'simplemde/dist/simplemde.min.css'
Vue.component('vue-simplemde', VueSimplemde)
```
## Props
| property | type | default | describe |
| ----| ----- | ----- | ---- |
| value | String | None | Initial value, v-model binding can be used |
| name | String | None | The name of the control. |
| preview-class | String | None | Custom preview style class |
| autoinit | Boolean | true | Automatic initialization |
| forceSync | Boolean | true | Sync value to simplemde each time |
| highlight | Boolean | false | Is it open to highlight |
| sanitize | Boolean | false | HTML that does not render input after opening |
| configs | Object | {} | [SimpleMDE's config](#configuration) |
| previewRender | Function | - | configs.previewRender |
## Events
| event | describe | arguments |
| ----| ----- | ---- |
| input | Triggered when the Input value changes | value |
| blur | Triggered when the Input loses focus | value |
| initialized | Triggered when initialization is complete | simplemde |
## Methods
``` js
this.$refs.markdownEditor.simplemde.togglePreview();
```
* [examples/index.vue](./examples/index.vue)
* [simplemde.js](https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L1908-L2026)
## Markdown style
> e.g. use Github's markdown style
[github-markdown-css](https://github.com/sindresorhus/github-markdown-css)
### install
``` bash
$ npm install --save github-markdown-css
```
### use
``` vue
<template>
<vue-simplemde preview-class="markdown-body" />
</template>
<style>
@import '~simplemde/dist/simplemde.min.css';
@import '~github-markdown-css';
</style>
```
## Highlight
### install
```
$ npm install --save highlight.js
```
### use
``` vue
<template>
<vue-simplemde :highlight="true" />
</template>
<script>
import hljs from 'highlight.js';
window.hljs = hljs;
</script>
<style>
@import '~simplemde/dist/simplemde.min.css';
@import '~highlight.js/styles/atom-one-dark.css';
/* Highlight theme list: https://github.com/isagalaev/highlight.js/tree/master/src/styles */
</style>
```
## Editor Theme ([simplemde-theme-base](https://github.com/xcatliu/simplemde-theme-base/wiki/List-of-themes))
> e.g. use simplemde-theme-base theme
### install
```
$ npm install --save simplemde-theme-base
```
### use
``` vue
<style>
@import '~simplemde-theme-base/dist/simplemde-theme-base.min.css';
/* no need import simplemde.min.css */
</style>
```
### e.g.
[Dark Theme](https://github.com/xcatliu/simplemde-theme-dark)
![Screenshot of SimpleMDE Theme Dark](https://github.com/xcatliu/simplemde-theme-dark/raw/master/docs/screenshot.png)
## Configuration
> SimpleMD's config
* [中文](doc/configuration_zh.md)
* [English](doc/configuration_en.md)
## Examples
* [Simple Example](./examples/index.vue)
* [Nuxt Example](./examples/nuxt)
* [Demo Page](https://f-loat.github.io/vue-simplemde/)
* [Demo Source](https://github.com/F-loat/vue-simplemde/tree/gh-pages)
## Dependencies
* [SimpleMDE](https://github.com/sparksuite/simplemde-markdown-editor)
## Licence
vue-simplemde is open source and released under the MIT Licence.
Copyright (c) 2022 F-loat
徐浪老师
- 粉丝: 8613
- 资源: 1万+
最新资源
- "基于算法设计文档 永磁同步电机最大转矩电流比控制算法的仿真模型研究",永磁同步电机的MTPA最大转矩电流比控制算法的仿真模型,有详细的算法设计文档 1. 永磁同步电机的数学模型; 2. 永磁同步电
- 坦途智能(智能滑板车及电踏车生产商,苏州坦途智能科技有限公司)创投信息
- Java毕业设计-springboot-vue-仓库管理系统(源码+sql脚本+29页零基础部署图文详解+30页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-笔记记录分享网站(源码+sql脚本+29页零基础部署图文详解+37页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-车辆违章信息管理系统(源码+sql脚本+29页零基础部署图文详解+32页论文+环境工具+教程+视频+模板).zip
- 基于麻雀搜索算法SSA优化LSTM神经元的拟合预测建模:详细注释,多图分析,matlab 2020b实现,基于麻雀搜索算法SSA优化LSTM的隐含层神经元个数,最佳学习率,最佳迭代次数,建立多特征输入
- 图灵智造(工业机器人研发商,上海图灵智造机器人有限公司)创投信息
- Java毕业设计-springboot-vue-城市垃圾分类管理系统(源码+sql脚本+29页零基础部署图文详解+31页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-宠物健康顾问系统(源码+sql脚本+29页零基础部署图文详解+30页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-城乡居民基本医疗信息管理系统(源码+sql脚本+29页零基础部署图文详解+34页论文+环境工具+教程+视频+模板).zip
- QT编程基础指南:QtCreator快捷键、命名规范及注意事项
- 苇渡科技(新能源自动驾驶重卡制造商,安徽苇渡科技有限公司)创投信息
- 基于几何平均谱分割的经验小波变换在轴承故障诊断中的应用(以MATLAB r2021b环境下的多峰值分析为例),几何平均谱分割经验小波变在轴承故障诊断中的应用 程序运行环境为MATLAB r2021b
- Java毕业设计-springboot-vue-船舶监造系统(源码+sql脚本+29页零基础部署图文详解+29页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-船舶维保管理系统(源码+sql脚本+29页零基础部署图文详解+32页论文+环境工具+教程+视频+模板).zip
- Java毕业设计-springboot-vue-宠物猫认养系统(源码+sql脚本+29页零基础部署图文详解+33页论文+环境工具+教程+视频+模板).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈