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 2525 "mockjs" : " 1.0.1-beta3" ,
2626 "normalize.css" : " 3.0.2" ,
2727 "nprogress" : " 0.2.0" ,
28+ "showdown" : " 1.7.1" ,
2829 "simplemde" : " 1.11.2" ,
2930 "sortablejs" : " 1.5.1" ,
3031 "vue" : " 2.3.3" ,
Original file line number Diff line number Diff line change 44 <div class =" editor-container" >
55 <MdEditor id =' contentEditor' ref =" contentEditor" v-model =' content' :height =" 300" :zIndex =' 20' ></MdEditor >
66 </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 >
79 </div >
810</template >
911<script >
1315 components: { MdEditor },
1416 data () {
1517 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+ })
1728 }
1829 }
1930 };
You can’t perform that action at this time.
0 commit comments