Skip to content

Commit 597b35d

Browse files
author
- -
committed
optimize instruction
1 parent 7a7401a commit 597b35d

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,34 @@ export default {
5454
```
5555

5656
``` javascript
57-
// 获取编辑器对象,添加事件绑定
57+
import { markdownEditor } from 'vue-simplemde'
58+
59+
// 基础用法
60+
export default {
61+
components: {
62+
markdownEditor
63+
},
64+
data () {
65+
return {
66+
content: '',
67+
configs: {
68+
spellChecker: false // 禁用拼写检查
69+
}
70+
}
71+
}
72+
}
73+
74+
// 添加更多配置,获取编辑器对象,添加事件绑定,判断编辑器状态
5875
export default {
76+
components: {
77+
markdownEditor
78+
},
5979
data () {
6080
return {
61-
content: 'lalala',
81+
content: '',
6282
configs: {
63-
status: false,
83+
status: false, // 禁用底部状态栏
84+
initialValue: 'hellow', // 设置初始值
6485
renderingConfig: {
6586
codeSyntaxHighlighting: true, // 开启代码高亮
6687
highlightingTheme: 'atom-one-light' // 自定义代码高亮主题,可选列表(https://github.com/isagalaev/highlight.js/tree/master/src/styles)
@@ -75,7 +96,7 @@ export default {
7596
},
7697
mounted: {
7798
console.log(this.simplemde)
78-
this.simplemde.value('hellow')
99+
this.simplemde.togglePreview()
79100

80101
// 'change'事件已经绑定,可以通过@input指定处理器
81102
// 如果需要,你可以自行绑定这个列表中的其他事件: https://codemirror.net/doc/manual.html#events
@@ -92,6 +113,11 @@ export default {
92113
this.simplemde.isSideBySideActive() // returns boolean
93114
this.simplemde.isFullscreenActive() // returns boolean
94115
this.simplemde.clearAutosavedValue() // no returned value
116+
},
117+
methods: {
118+
handleInput () {
119+
// do some things
120+
}
95121
}
96122
}
97123
```

0 commit comments

Comments
 (0)