Skip to content

Commit f2e183a

Browse files
committed
docs: update slot syntax examples
1 parent 0a1137d commit f2e183a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

docs/guide/essentials/components.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,16 @@ Parent markup:
789789

790790
```html
791791
<app-layout>
792-
<h1 slot="header">Here might be a page title</h1>
792+
<template v-slot:header>
793+
<h1>Here might be a page title</h1>
794+
</template>
793795

794796
<p>A paragraph for the main content.</p>
795797
<p>And another one.</p>
796798

797-
<p slot="footer">Here's some contact info</p>
799+
<template v-slot:footer>
800+
<p>Here's some contact info</p>
801+
</template>
798802
</app-layout>
799803
```
800804

@@ -860,7 +864,7 @@ Now when we use the `<todo-list>` component, we can optionally define an alterna
860864
<vue-gwt:import class="com.mypackage.Todo"/>
861865
<todo-list v-bind:todos="todos">
862866
<!-- Define a variable todo that will get the value of the binded attribute todo -->
863-
<template slot-scope="{ Todo todo }">
867+
<template v-slot="{ Todo todo }">
864868
<!-- Define a custom template for todo items, using -->
865869
<!-- `slotProps` to customize each todo. -->
866870
<span v-if="todo.isComplete()">✓</span>
@@ -925,7 +929,7 @@ The API for a Vue component comes in three parts - props, events, and slots:
925929

926930
- **Slots** allow the external environment to compose the component with extra content.
927931

928-
With the dedicated shorthand syntaxes for `v-bind` and `v-on`, the intents can be clearly and succinctly conveyed in the template:
932+
With the dedicated shorthand syntax for `v-bind` and `v-on`, the intents can be clearly and succinctly conveyed in the template:
929933

930934
```html
931935
<my-component
@@ -934,8 +938,12 @@ With the dedicated shorthand syntaxes for `v-bind` and `v-on`, the intents can b
934938
@event-a="doThis"
935939
@event-b="doThat"
936940
>
937-
<img slot="icon" src="...">
938-
<p slot="main-text">Hello!</p>
941+
<template v-slot:icon>
942+
<img src="...">
943+
</template>
944+
<template v-slot:main-text>
945+
<p>Hello!</p>
946+
</template>
939947
</my-component>
940948
```
941949

0 commit comments

Comments
 (0)