Skip to content

Commit b1a9d83

Browse files
xiaodong2008kermanx
authored andcommitted
feat: add VSwitch component (#1562)
Co-authored-by: _Kerman <kermanx@qq.com>
1 parent 4d05007 commit b1a9d83

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

builtin/components.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ Parameters:
259259

260260
See https://sli.dev/guide/animations.html
261261

262+
### `VSwitch`
263+
264+
Switch between multiple slots based on clicks.
265+
266+
See https://sli.dev/guide/animations.html#enter-leave
267+
268+
- If the `unmount` prop is set to `true`, the previous slot will be unmounted when switching to the next slot. Default is `false`.
269+
- Use the `tag` and `childTag` props to change the default tag of the component and its children. Default is `div`.
270+
- Use the `transition` prop to change the transition effect. Default is `false` (disabled).
271+
262272
### `VDrag`
263273

264274
See https://sli.dev/guide/draggable.html

guide/animations.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,24 @@ You can also specify the enter and leave index for the `v-click` directive by pa
193193
<div v-click.hide="[2, 4]">
194194
This will be hidden at click 2 and 3.
195195
</div>
196-
197196
<div v-click />
198197
<div v-click="'[+1, +1]'">
199198
This will be shown at click 3, and hidden since click 4.
200199
</div>
201200
```
202201

202+
You can also use `v-switch` to achieve the same effect:
203+
204+
```md
205+
<v-switch>
206+
<template #1> show at click 1, hide at click 2. </template>
207+
<template #2> show at click 2, hide at click 5. </template>
208+
<template #5-7> show at click 5, hide at click 7. </template>
209+
</v-switch>
210+
```
211+
212+
See [`VSwitch` Component](/builtin/components#vswitch) for more details.
213+
203214
### Custom Total Clicks Count
204215

205216
By default, Slidev counts how many steps are needed before going to the next slide. You can override this setting by passing the `clicks` frontmatter option:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy