2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-05 19:32:24 +03:00

example: Update examples

This commit is contained in:
Atinux
2017-11-06 12:32:18 +01:00
parent be9cff3bd3
commit 8ac7ecccaa
2 changed files with 10 additions and 6 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ new Vue({
{ name: 'description', content: 'Hello', vmid: 'test' }
],
script: [
{ innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' }
{ innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' },
{ innerHTML: '{ "body": "yes" }', body: true, type: 'application/ld+json' }
],
__dangerouslyDisableSanitizers: ['script']
})
+8 -5
View File
@@ -15,7 +15,8 @@ const vm = new Vue({
{ hid: 'description', name: 'description', content: 'Hello World' }
],
script: [
{ innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' }
{ innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' },
{ innerHTML: '{ "body": "yes" }', body: true, type: 'application/ld+json' }
],
__dangerouslyDisableSanitizers: ['script']
},
@@ -34,8 +35,10 @@ const vm = new Vue({
renderer.renderToString(vm, function (err, html) {
if (err) throw err
console.log('Title', vm.$meta().inject().title.text())
console.log('HTML', vm.$meta().inject().htmlAttrs.text())
console.log('Meta', vm.$meta().inject().meta.text())
console.log('Script', vm.$meta().inject().script.text())
const $meta = vm.$meta().inject()
console.log('Title:\n' + $meta.title.text())
console.log('\nHTML attrs:\n' + $meta.htmlAttrs.text())
console.log('\nMeta:\n' + $meta.meta.text())
console.log('\nHead Script:\n' + $meta.script.text())
console.log('\nBody Script:\n' + $meta.script.text({ body: true }))
})