跳转到内容

Tour 漫游式引导

何时使用

常用于引导用户了解产品功能。

代码演示

基本

loading

非模态

loading

位置

loading

自定义遮罩样式

loading

自定义指示器

loading

自定义操作按钮

loading

自定义高亮区域的样式

loading

API

Tour

属性说明类型默认值版本
arrow是否显示箭头,包含是否指向元素中心的配置boolean | { pointAtCenter: boolean}true
closeIcon自定义关闭按钮VNodetrue5.9.0
disabledInteraction禁用高亮区域交互booleanfalse5.13.0
gap控制高亮区域的圆角边框和显示间距{ offset?: number | [number, number]; radius?: number }{ offset?: 6 ; radius?: 2 }5.0.0 (数组类型的 offset: 5.9.0 )
placement引导卡片相对于目标元素的位置center left leftTop leftBottom right rightTop rightBottom top topLeft topRight bottom bottomLeft bottomRightbottom
onClose关闭引导时的回调函数Function-
onFinish引导完成时的回调Function-
mask是否启用蒙层,也可传入配置改变蒙层样式和填充色boolean | { style?: CSSProperties; color?: string; }true
type类型,影响底色与文字颜色default | primarydefault
open打开引导boolean-
onChange步骤改变时的回调,current 为当前的步骤(current: number) => void-
current当前处于哪一步number-
scrollIntoViewOptions是否支持当前元素滚动到视窗内,也可传入配置指定滚动视窗的相关参数boolean | ScrollIntoViewOptionstrue5.2.0
indicatorsRender自定义指示器(current: number, total: number) => ReactNode-5.2.0
actionsRender自定义操作按钮(originNode: ReactNode, info: { current: number, total: number }) => ReactNode-5.25.0
zIndexTour 的层级number10015.3.0
getPopupContainer设置 Tour 浮层的渲染节点,默认是 body(node: HTMLElement) => HTMLElementbody5.12.0

TourStep 引导步骤卡片

属性说明类型默认值版本
target获取引导卡片指向的元素,为空时居中于屏幕() => HTMLElement | HTMLElement-
arrow是否显示箭头,包含是否指向元素中心的配置boolean | { pointAtCenter: boolean}true
closeIcon自定义关闭按钮VNodetrue5.9.0
cover展示的图片或者视频ReactNode-
title标题ReactNode-
description主要描述部分ReactNode-
placement引导卡片相对于目标元素的位置center left leftTop leftBottom right rightTop rightBottom top topLeft topRight bottom bottomLeft bottomRightbottom
onClose关闭引导时的回调函数Function-
mask是否启用蒙层,也可传入配置改变蒙层样式和填充色,默认跟随 Tour 的 mask 属性boolean | { style?: CSSProperties; color?: string; }true
type类型,影响底色与文字颜色default | primarydefault
nextButtonProps下一步按钮的属性{ children: ReactNode; onClick: Function }-
prevButtonProps上一步按钮的属性{ children: ReactNode; onClick: Function }-
scrollIntoViewOptions是否支持当前元素滚动到视窗内,也可传入配置指定滚动视窗的相关参数,默认跟随 Tour 的 scrollIntoViewOptions 属性boolean | ScrollIntoViewOptionstrue5.2.0

基于 MIT 许可发布