Files
mes-ui-d2/src/pages/demo/plugins/marked/demo.vue
李杨 ef8cb3c8e7 no message
Former-commit-id: 3c8b725b82460ee3a1b5c2ff54bdd8e6d78b63c0
Former-commit-id: 3ad6a05be509ffe7268381c01c32074662f0d0af
Former-commit-id: 6a8bc07bb5bd109d413d40743c0b0751fcd09caa
2018-01-25 08:00:48 +08:00

44 lines
998 B
Vue

<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.$http.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
return data
}
}
}
</script>