Vue Component Inside Vuepress

Tags: vuepress vuejs

Create a new file for your component:

touch .vuepress/components/example.vue
1

Add the following code to .vuepress/components/example.vue:

<template lang="html">
  <h1>Hello, world</h1>
</template>
1
2
3

In your markdown file, add the following:

<example></example>
1

You can see it in action in the H1 title below:

Hello, world

TIP

Don't worry about telling Vuepress to pick up your component. Every Vue.js component in the .vuepress/components is registered as a global component.


Copyright © 2018 Daniel and Audrey Roy Greenfeld.
Site Map

Last Updated: 8/26/2018, 5:04:16 PM