File tree Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -54,13 +54,34 @@ export default {
54
54
```
55
55
56
56
``` 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
+ // 添加更多配置,获取编辑器对象,添加事件绑定,判断编辑器状态
58
75
export default {
76
+ components: {
77
+ markdownEditor
78
+ },
59
79
data () {
60
80
return {
61
- content: ' lalala ' ,
81
+ content: ' ' ,
62
82
configs: {
63
- status: false ,
83
+ status: false , // 禁用底部状态栏
84
+ initialValue: ' hellow' , // 设置初始值
64
85
renderingConfig: {
65
86
codeSyntaxHighlighting: true , // 开启代码高亮
66
87
highlightingTheme: ' atom-one-light' // 自定义代码高亮主题,可选列表(https://github.com/isagalaev/highlight.js/tree/master/src/styles)
@@ -75,7 +96,7 @@ export default {
75
96
},
76
97
mounted: {
77
98
console .log (this .simplemde )
78
- this .simplemde .value ( ' hellow ' )
99
+ this .simplemde .togglePreview ( )
79
100
80
101
// 'change'事件已经绑定,可以通过@input指定处理器
81
102
// 如果需要,你可以自行绑定这个列表中的其他事件: https://codemirror.net/doc/manual.html#events
@@ -92,6 +113,11 @@ export default {
92
113
this .simplemde .isSideBySideActive () // returns boolean
93
114
this .simplemde .isFullscreenActive () // returns boolean
94
115
this .simplemde .clearAutosavedValue () // no returned value
116
+ },
117
+ methods: {
118
+ handleInput () {
119
+ // do some things
120
+ }
95
121
}
96
122
}
97
123
```
You can’t perform that action at this time.
0 commit comments