From 8ac7ecccaacb30beeac3d826897868ec1fb89dcc Mon Sep 17 00:00:00 2001 From: Atinux Date: Mon, 6 Nov 2017 12:32:18 +0100 Subject: [PATCH] example: Update examples --- examples/basic/app.js | 3 ++- examples/ssr.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/basic/app.js b/examples/basic/app.js index 4a5eea9..d7aa71a 100644 --- a/examples/basic/app.js +++ b/examples/basic/app.js @@ -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'] }) diff --git a/examples/ssr.js b/examples/ssr.js index 3b158b6..1c44d4c 100644 --- a/examples/ssr.js +++ b/examples/ssr.js @@ -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 })) })