使用于鼠标 hover 时展示的气泡式提示。
基本用法
位置
不同的触发方式
虚拟触发
参数 | 描述 | 类型 | 默认值 |
---|
content | 提示内容 | string | —— |
trigger | 触发方式 | enum | hover |
effect | 亮色或暗色主题 | enum | dark |
placement | 出现位置 | enum popper.js | bottom |
appendTo | 浮层要挂载的DOM节点 | HTMLElement \ string | body |
pure | 内边距是否为0 | boolean | false |
disabled | 是否禁用 | boolean | false |
visible / v-model:visible | 显示/隐藏 | boolean | —— |
offset | 出现位置的偏移量 | number | 12 |
popperOptions | popper.js 的配置项 | object 参考popper.js文档 | —— |
rawContent | content 中的内容是否作为HTML字符串处理 | boolean | false |
showAfter | 延迟出现(毫秒) | number | 0 |
hideAfter | 延迟消失(毫秒) | number | 200 |
showArrow | 是否显示箭头 | boolean | true |
fallback-placements | popper.js 属性 | Array | —— |
popperClass | 自定义 popper 类名 | string | —— |
autoClose | tooltip 出现后自动隐藏延时,单位毫秒 | number | 0 |
virtual-triggering | 是否使用虚拟触发 | boolean | false |
virtual-ref | 虚拟触发的元素 | HTMLElement | —— |
persistent | 当popper长时间不触发,且persistent为false时, popconfirm 将会被删除 | boolean | false |
aria-label | 无障碍属性 | string | —— |
事件名 | 描述 | 类型 |
---|
update:visible | 出现/消失时触发 | Function |
bofore-show | 消失前时触发 | Function |
before-hide | 出现前时触发 | Function |
show | 出现时触发 | Function |
hide | 消失时触发 | Function |
插槽名 | 描述 |
---|
default | 自定义内容 |
content | tooltip 的内容 |
名称 | 描述 | 类型 |
---|
popperRef | n-popper 组件实例 | object |
contentRef | n-tooltip-content 组件实例 | object |
isFocusInsideContent | 验证当前焦点事件是否在 n-tooltip-content 中触发 | Function |
updatePopper | 更新 n-tooltip 组件 | Function |
onOpen | 显示 tooltip 的内容 | Function |
onClose | 隐藏 tooltip 的内容 | Function |
hide | 隐藏 tooltip 的内容 | Function |