Skip to content

Commit

Permalink
doc: add tips about inline script in README.md script example (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong authored and manniL committed Jan 24, 2019
1 parent d174c88 commit bf7035b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

```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
{
metaInfo: {
script: [
{ innerHTML: '{ "@context": "http://schema.org" }', type: 'application/ld+json' }
]
],
__dangerouslyDisableSanitizers: ['script'],
}
}
```
Expand Down

0 comments on commit bf7035b

Please sign in to comment.