Former-commit-id: 854dacd28d5d176d72cc1fbdc625917326be6daf Former-commit-id: 889bcea85881a67a17a791d3c445cdb43fdb1a85 Former-commit-id: adb66c36629380ccf256313d10dd99a34f993e50
44 lines
995 B
Vue
44 lines
995 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.$axios.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
|
|
return data
|
|
}
|
|
}
|
|
}
|
|
</script> |