Tooltip 文字提示

使用于鼠标 hover 时展示的气泡式提示。

TIP

此组件在 n-popper 的基础上封装, 而 n-popper组件在popper.js的基础上开发

基本用法

位置

不同的触发方式

虚拟触发

Tooltip API

Tooltip Props

参数描述类型默认值
content提示内容string——
trigger触发方式enumhover
effect亮色或暗色主题enumdark
placement出现位置enumpopper.jsbottom
appendTo浮层要挂载的DOM节点HTMLElement\ stringbody
pure内边距是否为0booleanfalse
disabled是否禁用booleanfalse
visible / v-model:visible显示/隐藏boolean——
offset出现位置的偏移量number12
popperOptionspopper.js 的配置项object 参考popper.js文档——
rawContentcontent 中的内容是否作为HTML字符串处理booleanfalse
showAfter延迟出现(毫秒)number0
hideAfter延迟消失(毫秒)number200
showArrow是否显示箭头booleantrue
fallback-placementspopper.js 属性Array——
popperClass自定义 popper 类名string——
autoClosetooltip 出现后自动隐藏延时,单位毫秒number0
virtual-triggering是否使用虚拟触发booleanfalse
virtual-ref虚拟触发的元素HTMLElement——
persistent当popper长时间不触发,且persistent为false时, popconfirm 将会被删除booleanfalse
aria-label无障碍属性string——

Tooltip Emits

事件名描述类型
update:visible出现/消失时触发Function
bofore-show消失前时触发Function
before-hide出现前时触发Function
show出现时触发Function
hide消失时触发Function

Tooltip Slots

插槽名描述
default自定义内容
contenttooltip 的内容

Tooltip Exposes

名称描述类型
popperRefn-popper 组件实例object
contentRefn-tooltip-content 组件实例object
isFocusInsideContent验证当前焦点事件是否在 n-tooltip-content 中触发Function
updatePopper更新 n-tooltip 组件Function
onOpen显示 tooltip 的内容Function
onClose隐藏 tooltip 的内容Function
hide隐藏 tooltip 的内容Function
上次更新时间: