Skip to content

Tooltip 文字提示

轻量的提示浮层,支持多种触发方式与独特功能。

基础用法

触发方式

支持 hover、click、focus、contextmenu、longpress(移动端友好)。

位置与自动定位

通过 placement 指定位置,或使用 auto 自动选择最佳空间方位。

内可交互

设置 interactiveenterable,允许鼠标进入 Tooltip 区域进行操作。

跟随光标(独特)

设置 follow-cursor,提示将跟随指针移动,适合图标密集或数据点悬浮。

选区锚点(独特)

设置 anchor-selection,当存在文字选区时,Tooltip 自动锚定到选区范围。

主题(Glass / 渐变)

内置独特主题:glass 毛玻璃、gradient 渐变。

API

Attributes

属性名说明类型默认值
content提示内容(支持字符串/VNode/渲染函数)string / VNode / Function
trigger触发方式hover / click / focus / contextmenu / longpresshover
placement位置top / right / bottom / left / autotop
enterable鼠标进入 Tooltip 是否保持显示booleantrue
interactiveTooltip 内部是否可交互booleanfalse
open-delay打开延迟(毫秒)number100
close-delay关闭延迟(毫秒)number100
offset触发与浮层之间的距离(像素)number10
show-arrow是否显示箭头booleantrue
theme主题default / glass / gradientdefault
follow-cursor是否跟随光标(独特)booleanfalse
anchor-selection是否锚定到文字选区(独特)booleanfalse
max-width内容最大宽度string / number260px
persist是否外部点击不关闭booleanfalse
disabled是否禁用booleanfalse

Events

事件名说明回调参数
visible-change显隐变化时触发(visible: boolean)