no message
Former-commit-id: 03338a46f1b92afe6337edba6fc351385940311b Former-commit-id: f66bc3c1d5bd899f63e9caf5ecff893910b766cd Former-commit-id: b7acc321b522db2f21daa2346f7aebf0b3de3148
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
<template>
|
||||
<Container type="ghost">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<PageHeader
|
||||
slot="header"
|
||||
title="基本示例"
|
||||
url="https://github.com/chjj/marked">
|
||||
</PageHeader>
|
||||
<pre>{{mdSource}}</pre>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<template slot="header">解析结果</template>
|
||||
<div class="markdown-body" v-html="markedHTML"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import marked from 'marked'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
mdSource: '',
|
||||
markedHTML: ''
|
||||
}
|
||||
},
|
||||
async mounted () {
|
||||
this.mdSource = await this.getReadme(this.url)
|
||||
this.markedHTML = marked(this.mdSource)
|
||||
},
|
||||
methods: {
|
||||
async getReadme () {
|
||||
const data = await this.$axios.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,49 +0,0 @@
|
||||
<template>
|
||||
<Container type="ghost">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<PageHeader
|
||||
slot="header"
|
||||
title="代码高亮"
|
||||
url="https://github.com/chjj/marked">
|
||||
</PageHeader>
|
||||
<pre>{{mdSource}}</pre>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<template slot="header">解析结果</template>
|
||||
<div class="markdown-body" v-html="markedHTML"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import marked from 'marked'
|
||||
import highlight from 'highlight.js'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
mdSource: '',
|
||||
markedHTML: ''
|
||||
}
|
||||
},
|
||||
async mounted () {
|
||||
this.mdSource = await this.getReadme(this.url)
|
||||
this.markedHTML = marked(this.mdSource, {
|
||||
highlight: (code) => {
|
||||
return highlight.highlightAuto(code).value
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
async getReadme () {
|
||||
const data = await this.$axios.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user