文章正文包括各种数据:段落、标题、列表、链接、图片、视频等资源。
将 github-markdown-css 样式文件下载到项目中
yarn add github-markdown-css
导入
import './github-markdown.css'
在对应的文章标签添加类名
<div class="article-content markdown-body" v-html="article.content"></div>
配置postcss包不要自动转换github-markdown-css样式文件中的字号,不然会影响不同客户端之间的体验
'postcss-pxtorem': {
rootValue ({ file }) {
return file.indexOf('vant') !== -1 ? 37.5 : 75
},
propList: ['*'],
exclude: 'github-markdown'
}