组件
引导 Tour
Tour:引导。页面变暗,只有聚光区域保留聚焦光晕,锚定卡片使用共享弹层。部件:Root、Backdrop、Spotlight、Positioner、Content、Arrow、ArrowTip、Title、Description、ProgressText、Control、Actions、ActionTrigger、CloseTrigger,以及 useTour。
#基础用法
Anchor element
<script setup lang="ts">
import { Button, Tour, useTour } from "@bysages/vue";
const tour = useTour({
steps: [
{
id: "welcome",
type: "dialog",
title: "Welcome",
description: "A short walk through the room before the ink settles.",
actions: [{ label: "Start", action: "next" }],
},
{
id: "anchor",
type: "tooltip",
title: "The worktable",
description: "Everything stays on the paper; nothing leaves the page.",
target: () => document.getElementById("tour-anchor"),
actions: [{ label: "Finish", action: "dismiss" }],
},
],
});
</script>
<template>
<Tour.Root :tour="tour">
<Button @click="tour.start()">Start tour</Button>
<div id="tour-anchor" class="p-4 border border-dashed border-border">Anchor element</div>
<Teleport to="body">
<Tour.Backdrop />
<Tour.Spotlight />
<Tour.Positioner>
<Tour.Content>
<Tour.ProgressText />
<Tour.Title />
<Tour.Description />
<Tour.Control>
<Tour.Actions v-slot="actions">
<Tour.ActionTrigger v-for="action in actions" :key="action.label" :action="action">
{{ action.label }}
</Tour.ActionTrigger>
</Tour.Actions>
</Tour.Control>
</Tour.Content>
</Tour.Positioner>
</Teleport>
</Tour.Root>
</template>
#属性
#ActionTrigger
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
action | StepAction | — |
#Actions
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#ArrowTip
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Arrow
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Backdrop
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#CloseTrigger
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Content
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Control
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Description
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Positioner
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#ProgressText
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Root
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
tour | UnwrapRef<UseTourReturn> | — |
#Spotlight
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#Title
纯造型的部件——自身没有属性,沿用部件结构的共享样式。