Skip to content

Commit 604c9da

Browse files
Dave Goodchildchrisvfritz
Dave Goodchild
authored andcommitted
Update directive documentation with tip relating to v-html and scoped styles (#1259)
* Update index.md Adding a tip relating to the fact that v-html content is unaffected by scoped styling, and explaining an example way around it. * Revise note about v-html and scoped styles
1 parent 8cc9f18 commit 604c9da

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/v2/api/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,8 @@ type: api
16861686
16871687
<p class="tip">Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use `v-html` on trusted content and **never** on user-provided content.</p>
16881688
1689+
<p class="tip">In [single-file components](../guide/single-file-components.html), `scoped` styles will not apply to content inside `v-html`, because that HTML is not processed by Vue's template compiler. In you want to target `v-html` content with scoped CSS, you can instead use [CSS modules](https://vue-loader.vuejs.org/en/features/css-modules.html) or an additional, global `<style>` element with a manual scoping strategy such as BEM.</p>
1690+
16891691
- **Example:**
16901692
16911693
```html

0 commit comments

Comments
 (0)