Tour Since v2.2.0
Used to guide users on how to use certain features.
Demos#
Basis Usage#
Simplest usage.
Please select
Template Step#
Use the TourStep component to configure tour steps.
Tip Placement#
By setting the placement
prop in the step options, you can specify the placement of the step's tooltip.
When no valid target
is specified, the tooltip will be centered.
API#
Preset Types#
ts
type TourType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'error'
type TourSignType = 'dot' | 'bar' | 'count'
interface TourVirtual {
getBoundingClientRect(): { top: number, left: number, width: number, height: number }
}
type TourTarget =
| MaybeRef<string | MaybeInstance | TourVirtual>
| (() => string | MaybeElement | TourVirtual)
interface TourPayload {
start(): void,
prev(): void,
next(autoClose?: boolean): void,
close(): void
}
type TourStepRenderFn = (payload: TourPayload) => any
interface TourStepOptions {
target?: TourTarget,
placement?: Placement,
title?: string,
content?: string,
order?: number,
renderer?: TourStepRenderFn
}
type TourSlotParams = TourPayload & { step: TourStepOptions, index: number }
Tour Props#
Name | Type | Description | Default | Since |
---|---|---|---|---|
active | boolean | Set whether to display the tour, you can use v-model two-way binding | false | - |
closable | boolean | Set whether to display a close button | true | - |
hide-mask | boolean | Set whether to hide the mask layer | false | - |
index | number | Set the current step of tour, you can use v-model two-way binding | 0 | - |
locale | LocaleConfig['tour'] | Set the locale config | null | - |
padding | number | number | Set the padding of the target area | 10 | - |
permeable | boolean | Set whether mouse events can penetrate to the target area | false | - |
sign-type | TourSignType | Set the type of step sign | 'dot' | - |
steps | TourStepOptions[] | Tour steps configuration | [] | - |
type | TourType | Set the type of tips for tour steps | 'default' | - |
Tour Events#
Name | Description | Parameters | Since |
---|---|---|---|
change | Emitted when the current step of the tour changes | (index: number, step: TourStepOptions) | - |
close | Emitted when the close button is used to trigger the close | - | - |
toggle | Emitted when the active state of tour changes | (active: boolean) | - |
Tour Slots#
Name | Description | Parameters | Since |
---|---|---|---|
actions | The actions slots for tips | TourSlotParams | - |
body | The content slot for the tips | TourSlotParams | - |
close | The close button slot for the tips | TourSlotParams | - |
default | Used to define the TourStep components | - | - |
footer | The footer slot for tips | TourSlotParams | - |
header | The header slot for tips | TourSlotParams | - |
sign | The sign slot for the tips | TourSlotParams | - |
title | The title slot for the tips | TourSlotParams | - |
TourStep Props#
Name | Type | Description | Default | Since |
---|---|---|---|---|
content | string | Set the content of the tip | '' | - |
order | number | Set the order of the tip | 0 | - |
placement | Placement | Set the placement of the tip, the optional values are the same as floating-ui | 'bottom' | - |
renderer | TourStepRenderFn | Custom render function for the tip | null | - |
target | TourTarget | Set the target for the tip | null | - |
title | string | Set the title of the tip | '' | - |
type | TourType | Set the type of tip | 'default' | - |