0

I am working on a vue project and I need to embed a documentation inside a vue template ideally. I considered using vuepress for making documentation as it has a full-fledged theme for documentation which is perfect for the kind of documentation I want and also supports markdown to write documentation. I tried using vuepress but only includes components written in .vuepress/components folder. Is there a way I can include other vue components of my project inside the markdown files or output the markdown files as vue templates instead of static html files.

4

1 回答 1

2

你可以在 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>
于 2018-08-21T04:01:03.833 回答