Skip to content

Commit 0c5ad8c

Browse files
committed
fix content insertion examples with replace: true
1 parent cfb2da8 commit 0c5ad8c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

source/guide/components.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,10 @@ When there is only one `<content>` tag with no attributes, the entire original c
633633
Template for `my-component`:
634634

635635
``` html
636-
<h1>This is my component!</h1>
637-
<content>This will only be displayed if no content is inserted</content>
636+
<div>
637+
<h1>This is my component!</h1>
638+
<content>This will only be displayed if no content is inserted</content>
639+
</div>
638640
```
639641

640642
Parent markup that uses the component:
@@ -649,11 +651,11 @@ Parent markup that uses the component:
649651
The rendered result will be:
650652

651653
``` html
652-
<my-component>
654+
<div>
653655
<h1>This is my component!</h1>
654656
<p>This is some original content</p>
655657
<p>This is some more original content</p>
656-
</my-component>
658+
</div>
657659
```
658660

659661
### Multiple Insertion Points
@@ -665,9 +667,11 @@ The rendered result will be:
665667
For example, suppose we have a `multi-insertion` component with the following template:
666668

667669
``` html
668-
<content select="p:nth-child(3)"></content>
669-
<content select="p:nth-child(2)"></content>
670-
<content select="p:nth-child(1)"></content>
670+
<div>
671+
<content select="p:nth-child(3)"></content>
672+
<content select="p:nth-child(2)"></content>
673+
<content select="p:nth-child(1)"></content>
674+
</div>
671675
```
672676

673677
Parent markup:
@@ -683,11 +687,11 @@ Parent markup:
683687
The rendered result will be:
684688

685689
``` html
686-
<multi-insertion>
690+
<div>
687691
<p>Three</p>
688692
<p>Two</p>
689693
<p>One</p>
690-
</multi-insertion>
694+
</div>
691695
```
692696

693697
The content insertion mechanism provides fine control over how original content should be manipulated or displayed, making components extremely flexible and composable.

0 commit comments

Comments
 (0)