Skip to content

Commit 3945e1d

Browse files
committed
2.6: improve v-slot api entry
1 parent bff457f commit 3945e1d

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

src/v2/api/index.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,42 @@ type: api
22302230

22312231
- **Usage:**
22322232

2233-
Denote named slots or slots that expect to receive props. For detailed usage, see the links below.
2233+
Denote named slots or slots that expect to receive props.
2234+
2235+
- **Example:**
2236+
2237+
```html
2238+
<!-- named slots -->
2239+
<base-layout>
2240+
<template v-slot:header>
2241+
Header content
2242+
</template>
2243+
2244+
<template v-slot:default>
2245+
Default slot content
2246+
</template>
2247+
2248+
<template v-slot:footer>
2249+
Footer content
2250+
</template>
2251+
</base-layout>
2252+
2253+
<!-- named slot that receive props -->
2254+
<infinite-scroll>
2255+
<template v-slot:item="slotProps">
2256+
<div class="item">
2257+
{{ slotProps.item.text }}
2258+
</div>
2259+
</template>
2260+
</infinite-scroll>
2261+
2262+
<!-- default slot that receive props, with props destructuring -->
2263+
<mouse-position v-slot="{ x, y }">
2264+
Mouse position: {{ x }}, {{ y }}
2265+
</mouse-position>
2266+
```
2267+
2268+
For more details, see the links below.
22342269
22352270
- **See also:**
22362271
- [Components - Slots](../guide/components-slots.html)
@@ -2380,19 +2415,19 @@ type: api
23802415
- [Dynamic Components](../guide/components.html#Dynamic-Components)
23812416
- [DOM Template Parsing Caveats](../guide/components.html#DOM-Template-Parsing-Caveats)
23822417
2383-
### slot <sup>replaced</sup>
2418+
### slot <sup style="color:#c92222">Deprecated</sup>
23842419
2385-
**Replaced by [v-slot](#v-slot) since 2.6.0.**
2420+
**Prefer [v-slot](#v-slot) if you are using 2.6.0+.**
23862421
23872422
- **Expects:** `string`
23882423
23892424
Used on content inserted into child components to indicate which named slot the content belongs to.
23902425
23912426
- **See also:** [Named Slots with `slot`](../guide/components.html#Named-Slots-with-slot)
23922427
2393-
### slot-scope <sup>replaced</sup>
2428+
### slot-scope <sup style="color:#c92222">Deprecated</sup>
23942429
2395-
**Replaced by [v-slot](#v-slot) since 2.6.0.**
2430+
**Prefer [v-slot](#v-slot) if you are using 2.6.0+.**
23962431
23972432
- **Expects:** `function argument expression`
23982433

@@ -2404,9 +2439,9 @@ type: api
24042439

24052440
- **See also:** [Scoped Slots with `slot-scope`](../guide/components.html#Scoped-Slots-with-slot-scope)
24062441

2407-
### scope <sup>replaced</sup>
2442+
### scope <sup style="color:#c92222">Deprecated</sup>
24082443

2409-
**Replaced by [slot-scope](#slot-scope) since 2.5.0.**
2444+
**Replaced by [slot-scope](#slot-scope) since 2.5.0. Prefer [v-slot](#v-slot) if you are using 2.6.0+.**
24102445

24112446
Used to denote a `<template>` element as a scoped slot.
24122447

0 commit comments

Comments
 (0)