File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 25
25
"mockjs" : " 1.0.1-beta3" ,
26
26
"normalize.css" : " 3.0.2" ,
27
27
"nprogress" : " 0.2.0" ,
28
+ "showdown" : " 1.7.1" ,
28
29
"simplemde" : " 1.11.2" ,
29
30
"sortablejs" : " 1.5.1" ,
30
31
"vue" : " 2.3.3" ,
Original file line number Diff line number Diff line change 4
4
<div class =" editor-container" >
5
5
<MdEditor id =' contentEditor' ref =" contentEditor" v-model =' content' :height =" 300" :zIndex =' 20' ></MdEditor >
6
6
</div >
7
+ <el-button @click =' markdown2Html' style =" margin-top :80px ;" type =" primary" >转为HTML<i class =" el-icon-document el-icon--right" ></i ></el-button >
8
+ <div v-html =" html" ></div >
7
9
</div >
8
10
</template >
9
11
<script >
13
15
components: { MdEditor },
14
16
data () {
15
17
return {
16
- content: ' Simplemde'
18
+ content: ' Simplemde' ,
19
+ html: ' '
20
+ }
21
+ },
22
+ methods: {
23
+ markdown2Html () {
24
+ import (' showdown' ).then (showdown => {
25
+ const converter = new showdown.Converter ();
26
+ this .html = converter .makeHtml (this .content )
27
+ })
17
28
}
18
29
}
19
30
};
You can’t perform that action at this time.
0 commit comments