mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 12:10:35 +03:00
doc: add tips about inline script in README.md script example (#304)
This commit is contained in:
committed by
Alexander Lichter
parent
d174c8876c
commit
bf7035baf5
@@ -536,12 +536,29 @@ Each item in the array maps to a newly-created `<style>` element, where object p
|
|||||||
|
|
||||||
Each item in the array maps to a newly-created `<script>` element, where object properties map to attributes.
|
Each item in the array maps to a newly-created `<script>` element, where object properties map to attributes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
metaInfo: {
|
||||||
|
script: [
|
||||||
|
{ src: 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js', async: true, defer: true }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js" async="true" defer="true"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
:warning: You have to disable sanitizers so the content of `innerHTML` won't be escaped. Please refer to [\__dangerouslyDisableSanitizers](#__dangerouslydisablesanitizers-string) section below for more info on related risks.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
metaInfo: {
|
metaInfo: {
|
||||||
script: [
|
script: [
|
||||||
{ innerHTML: '{ "@context": "http://schema.org" }', type: 'application/ld+json' }
|
{ innerHTML: '{ "@context": "http://schema.org" }', type: 'application/ld+json' }
|
||||||
]
|
],
|
||||||
|
__dangerouslyDisableSanitizers: ['script'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user