2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-20 05:30:33 +03:00

Favor function syntax over per-attribute function syntax

This commit is contained in:
Declan de Wet
2016-11-10 15:28:21 +02:00
parent 7c58dfc725
commit 495f61629a
12 changed files with 87 additions and 79 deletions
+3 -3
View File
@@ -9,9 +9,9 @@ Vue.component('child', {
render (h) {
return h('h3', null, this.page)
},
metaInfo: {
title () {
return this.page
metaInfo () {
return {
title: this.page
}
}
})
+2 -2
View File
@@ -10,12 +10,12 @@ new Vue({
<p>Inspect Element to see the meta info</p>
</div>
`,
metaInfo: {
metaInfo: () => ({
title: 'Basic',
titleTemplate: '%s | Vue Meta Examples',
htmlAttrs: {
lang: 'en',
amp: undefined
}
}
})
}).$mount('#app')
+3 -3
View File
@@ -10,9 +10,9 @@ const ChildComponent = {
name: `child-component`,
props: ['page'],
template: `<h3>You're looking at the <strong>{{ page }}</strong> page</h3>`,
metaInfo: {
title () {
return this.page
metaInfo () {
return {
title: this.page
}
}
}
+10
View File
@@ -5,3 +5,13 @@
<p>Inspect Element to see the meta info</p>
</div>
</template>
<script>
export default {
metaInfo: {
meta: [
{ vmid: 'charset', charset: 'utf-8' }
]
}
}
</script>
+4 -1
View File
@@ -20,7 +20,10 @@
postsCount: 'publishedPostsCount'
}),
metaInfo: {
title: 'Home'
title: 'Home',
meta: [
{ vmid: 'description', name: 'description', content: 'The home page' }
]
}
}
</script>
+6 -3
View File
@@ -28,9 +28,12 @@
'isLoading',
'post'
]),
metaInfo: {
title () {
return this.isLoading ? 'Loading...' : this.post.title
metaInfo () {
return {
title: this.isLoading ? 'Loading...' : this.post.title,
meta: [
{ vmid: 'description', name: 'description', content: this.post.title }
]
}
}
}
+10
View File
@@ -5,3 +5,13 @@
<p>Inspect Element to see the meta info</p>
</div>
</template>
<script>
export default {
metaInfo: {
meta: [
{ vmid: 'charset', charset: 'utf-8' }
]
}
}
</script>
+4 -1
View File
@@ -20,7 +20,10 @@
postsCount: 'publishedPostsCount'
}),
metaInfo: {
title: 'Home'
title: 'Home',
meta: [
{ vmid: 'description', name: 'description', content: 'The home page' }
]
}
}
</script>
+6 -3
View File
@@ -18,9 +18,12 @@
computed: mapGetters([
'post'
]),
metaInfo: {
title () {
return this.post.title
metaInfo () {
return {
title: this.post.title,
meta: [
{ vmid: 'description', name: 'description', content: this.post.title }
]
}
}
}