2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-17 10:20:34 +03:00

chore: add docs site

This commit is contained in:
pimlie
2019-03-10 21:58:13 +01:00
parent 3db250dfea
commit 5aa94ceea3
17 changed files with 6173 additions and 92 deletions
+55
View File
@@ -0,0 +1,55 @@
# How to use component props or data
Easy. Instead of defining `metaInfo` as an object, define it as a function and access `this` as usual:
**Post.vue:**
```html
<template>
<div>
<h1>{{{ title }}}</h1>
</div>
</template>
<script>
export default {
name: 'post',
props: ['title'],
data () {
return {
description: 'A blog post about some stuff'
}
},
metaInfo () {
return {
title: this.title,
meta: [
{ vmid: 'description', name: 'description', content: this.description }
]
}
}
}
</script>
```
**PostContainer.vue:**
```html
<template>
<div>
<post :title="title"></post>
</div>
</template>
<script>
import Post from './Post.vue'
export default {
name: 'post-container',
components: { Post },
data () {
return {
title: 'Example blog post'
}
}
}
</script>
```