[RFC] New Component: Tour 漫游式引导 #37712
Replies: 12 comments 21 replies
-
onChange 这个应该是先目标,剩下才是先前。感觉现在是暂时不用提供先前的 arg |
Beta Was this translation helpful? Give feedback.
-
nonModal 拆一下,一个是 mask,另一个是 type |
Beta Was this translation helpful? Give feedback.
-
nextButtonText 这类看看能不能合成一个属性,nextButtonProps。Modal 里因为是先有的 okText 后有的 okButtonProps 其实挺怪异的 |
Beta Was this translation helpful? Give feedback.
-
onNext 这个具体一些是怎么回调的?看起来是点击? |
Beta Was this translation helpful? Give feedback.
-
一个页面有多个亮点需要考虑,比如高亮多个checkbox,属于一组,目前市面上的引导都很难改造出来 |
Beta Was this translation helpful? Give feedback.
-
感觉除了 |
Beta Was this translation helpful? Give feedback.
-
Looks great so far! Just my two cents on this:
I'm not sure if the translation I got is correct, as my Chinese is a bit rusty (lol), but it sounds like a troubleshooting mode when a target is specified but cannot be found. However, I think specifying one should be optional by design. Also, I would suggest two more APIs for the This can also be implemented using the |
Beta Was this translation helpful? Give feedback.
-
有可以设定target在视窗中center的选项吗? |
Beta Was this translation helpful? Give feedback.
-
遇到没有办法在一个组件内声明 steps 的情形:无法在一个组件内获取子组件中需要标记 ref 进行引导的子组件,steps 中的 target 能否更灵活一些,直接 document.getElementById |
Beta Was this translation helpful? Give feedback.
-
话说 为啥只限制在 Button元素上呢?我想挂在 Input上,报错了,有啥解决办法吗? @MadCcc |
Beta Was this translation helpful? Give feedback.
-
Summary
新增 Tour(漫游式引导)组件。
Motivation
对于拥有复杂功能的网页,或者推出新功能的网站,引导用户认识新的特性并学习新功能的用法非常重要。因此 Tour(漫游式引导)组件应运而生,主要用于引导用户认识网页中的某个或某些部分具有什么样的功能。
API
Tour
TourStepProps[]
boolean
current
受控分开)number
(current: number) => void
current
为改变前的步骤,next
为改变后的步骤(current: number) => void
() => void
boolean
true
boolean
|{ pointAtCenter: boolean}
true
default
|primary
default
TourStep 引导步骤卡片
() => HTMLElement
|HTMLElement
boolean
|{ pointAtCenter: boolean}
true
ReactNode
ReactNode
ReactNode
left
|leftTop
|leftBottom
|right
|rightTop
|rightBottom
|top
|topLeft
|topRight
|bottom
|bottomLeft
|bottomRight
bottom
Function
boolean
true
mask
属性default
|primary
default
{ children: ReactNode; onClick: Function }
{ children: '下一步' }
{ children: ReactNode; onClick: Function }
{ children: '上一步' }
string
React.CSSProperties
Basic Example
基础用法
Detailed Design
模态与非模态
maskClosable
控制是否可点击蒙层关闭 Tour。打开时其他元素不可点击。引导卡片的各个区域对应的 API
cover
;title
;description
;description
;onClose
可以赋予关闭时回调;arrow
;target
指定;mask={false}
关闭蒙层。目标元素不在视窗内时
通过
scrollIntoView
拉到视窗内实现任意定位
TourStep 的
placement
只提供相对于target
的相对定位,如果需要自定义位置,比如绝对定位位于屏幕中央,可以通过style
自定义position
和位置来实现。另外如果不指定 target,引导卡片会自动位于屏幕中央。
How we teach this
Drawbacks
No obvious drawbacks yet.
Bonus
Tour
(current: number) => ReactNode
Beta Was this translation helpful? Give feedback.
All reactions