【问题标题】:Vuepress theme in vue templateVue 模板中的 Vuepress 主题
【发布时间】:2019-01-15 20:18:12
【问题描述】:
我正在做一个 vue 项目,理想情况下我需要在 vue 模板中嵌入一个文档。我考虑使用 vuepress 来制作文档,因为它具有完整的文档主题,非常适合我想要的文档类型,并且还支持 markdown 来编写文档。我尝试使用 vuepress,但只包含写在 .vuepress/components 文件夹中的组件。有没有办法可以在markdown文件中包含我项目的其他vue组件,或者将markdown文件输出为vue模板而不是静态html文件。
【问题讨论】:
标签:
vue.js
vue-component
vuepress
【解决方案1】:
您可以在 Markdown 文件中使用字符串标签,就像在使用 webpack 的常规 vue 项目中一样。例如:
在 README.md 上:
# This is a title
## This is a subtitle
<my-component></my-component>
> My name is {{ name }}
<script>
import myComponent from '../myOtherFolder/MyComponent'
export default {
components: {
'my-component': myComponent
},
data: function() {
return {
name: 'John'
}
}
}
</script>