Skip to content

Tooltip 文字提示

用于展示简短说明文字,适合图标按钮、截断文本等需要补充说明的场景。

示例

基础用法

自定义内容

API

Props

属性名说明类型默认值示例
content提示内容string''content="提示内容"
placement出现位置Placement'bottom'placement="top"
disabled是否禁用booleanfalsedisabled
visible手动控制显隐boolean | nullnullv-model:visible="visible"
offset偏移量number-:offset="12"
visible-arrow是否显示箭头booleantrue:visible-arrow="false"
popper-optionsPopper 配置Partial<Options>{}:popper-options="{ strategy: 'fixed' }"
show-after延迟显示时间,单位 msnumber0:show-after="200"
hide-after延迟关闭时间,单位 msnumber250:hide-after="100"
auto-close是否自动关闭booleantrue:auto-close="false"
popper-class浮层类名string | object | array''popper-class="custom-tooltip"
enterable鼠标是否可进入浮层booleantrue:enterable="false"
effect主题'light' | 'dark''dark'effect="light"
width内容宽度string'auto'width="200px"

Events

事件名说明回调参数示例
update:visible显隐状态变化时触发(visible: boolean)@update:visible="onUpdate"

Slots

插槽名说明作用域参数示例
default触发元素-<template #default>
content自定义提示内容-<template #content>

Exposes

方法名说明类型示例
show显示提示() => voidtooltipRef.value?.show()
hide隐藏提示() => voidtooltipRef.value?.hide()

注意事项

  • Tooltip 内容应简短,不建议放置复杂交互。
  • 对重要信息不要只依赖悬浮提示,应在界面中直接展示。