@beisen-phoenix/tooltip
简单的文字提示气泡框。
Last updated 8 months ago by beisencorp .
ISC · Original npm · Tarball · package.json
$ cnpm install @beisen-phoenix/tooltip 
SYNC missed versions from official npm registry.

简单的文字提示气泡框。

概述

鼠标移入则显示提示的简单气泡浮层,应用于显示简单的文字提示,不承载复杂文本和操作。
可用来代替浏览器默认的 title 属性。

API

参数 说明 类型 默认值
title 提示文字,配合isHTMLContent可以支持html格式。 string
extraCls 自定义的容器class,一般通过此class来实现自定义样式 string
isHTMLContent 是否提示文字为html,如果置为true则正文会被当做html识别,同时会有xss潜在风险。 boolean false
showOverflowTooltip 根据文本是否打点来决定是否展示Tooltip,注意此时节点需要是仅有一层标签包裹的纯文本才能正确计算,详情请见样例。 boolean false
destroyTooltipOnHide 是否在tooltip隐藏时销毁dom节点 boolean false
arrowPointAtCenter 箭头是否指向目标元素中心 boolean true
autoAdjustOverflow 气泡被遮挡时自动调整位置 boolean true
defaultVisible 默认是否显隐 boolean false
getTooltipContainer 浮层渲染父节点,默认渲染到 body 上 Function(triggerNode) () => document.body
mouseEnterDelay 鼠标移入后延时多少才显示 Tooltip,单位:秒 number 0
mouseLeaveDelay 鼠标移出后延时多少才隐藏 Tooltip,单位:秒 number 0.1
overlayClassName 卡片类名 string
overlayStyle 卡片样式 object
placement 气泡框位置,可选 top left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom string top
trigger 触发行为,可选 hover string hover
visible 用于手动控制浮层显隐 boolean false
onVisibleChange 显示隐藏的回调 (visible) => void
align 该值将合并到 placement 的配置中,设置参考 rc-tooltip Object
maxWidth 蒙层的最大宽度 number

注意

请确保 Tooltip 的子元素能接受 onMouseEnteronMouseLeaveonFocusonClick 事件。

一点碎碎念

  • 整体思路来自 antdesign/tooltip,封装了rc-tooltip并在此基础上做了一些自动计算的处理。
  • 当横向超过一屏时,max-width的元素显示会无法维持自身的宽度,造成内塌陷,目前采用的解决方案是在初始化时使用临时的 div存放文字,取实际宽度设置给该元素,如果有更好的方案请反馈给我,
  • 没有设置title时,默认会以当前节点内的文字进行赋值
  • autoAdjustOverflow仅支持在文档边缘时触发,如果是滚动条滚动后遮住的情况,并不会进行调整。
  • showOverflowTooltip判断文本是否打点的逻辑是:取当前节点的scrollWidth和clientWidth,如果scrollWidth大于clientWidth,则为打点状态,其他情况为非打点状态。组件会根据该状态自动判断是否需要显示 tooltip。注意:出于性能考虑,此情况下文本内容仅会在初始化时取值一次,后续文本节点变更都不会同步。
  • 由于当元素从左侧超出界面之外时,rc的自适应逻辑会导致箭头方向错误,此处不得不使用额外计算逻辑来处理,这里可能会有bug。
  • 由下向上连续触发tooltip不消失的问题,可以使用mouseLeaveDelay参数设置为0来解决

Current Tags

  • 3.3.55                                ...           latest (8 months ago)
  • 3.2.44-rc.1                                ...           rc (9 months ago)

398 Versions

  • 3.3.55                                ...           8 months ago
  • 3.3.54                                ...           8 months ago
  • 3.3.53                                ...           8 months ago
  • 3.3.52                                ...           8 months ago
  • 3.3.51                                ...           8 months ago
  • 3.3.50                                ...           8 months ago
  • 3.3.49                                ...           8 months ago
  • 3.3.48                                ...           8 months ago
  • 3.3.47                                ...           8 months ago
  • 3.3.46                                ...           8 months ago
  • 3.3.45                                ...           8 months ago
  • 3.3.43                                ...           8 months ago
  • 3.3.42                                ...           8 months ago
  • 3.3.41-beta.1                                ...           8 months ago
  • 3.3.41                                ...           8 months ago
  • 3.3.39                                ...           8 months ago
  • 3.3.38                                ...           8 months ago
  • 3.3.37                                ...           8 months ago
  • 3.3.36                                ...           8 months ago
  • 3.3.35                                ...           8 months ago
  • 3.3.34                                ...           8 months ago
  • 3.3.33                                ...           8 months ago
  • 3.3.32                                ...           8 months ago
  • 3.3.31                                ...           8 months ago
  • 3.3.29                                ...           8 months ago
  • 3.3.28                                ...           8 months ago
  • 3.3.27                                ...           8 months ago
  • 3.3.26                                ...           8 months ago
  • 3.3.25                                ...           8 months ago
  • 3.3.24                                ...           8 months ago
  • 3.3.23                                ...           8 months ago
  • 3.3.22                                ...           8 months ago
  • 3.3.21                                ...           8 months ago
  • 3.3.20                                ...           8 months ago
  • 3.3.19                                ...           8 months ago
  • 3.3.18                                ...           8 months ago
  • 3.3.17                                ...           8 months ago
  • 3.3.16                                ...           8 months ago
  • 3.3.15                                ...           8 months ago
  • 3.3.14                                ...           8 months ago
  • 3.3.13                                ...           8 months ago
  • 3.3.12                                ...           8 months ago
  • 3.3.11                                ...           8 months ago
  • 3.3.10                                ...           8 months ago
  • 3.3.9                                ...           8 months ago
  • 3.3.8                                ...           8 months ago
  • 3.3.7                                ...           8 months ago
  • 3.3.6                                ...           8 months ago
  • 3.3.5                                ...           8 months ago
  • 3.2.80-beta.1                                ...           8 months ago
  • 3.2.80                                ...           8 months ago
  • 3.3.4                                ...           8 months ago
  • 3.3.3                                ...           8 months ago
  • 3.3.1                                ...           8 months ago
  • 3.3.0                                ...           8 months ago
  • 3.2.97                                ...           8 months ago
  • 3.2.95                                ...           8 months ago
  • 3.2.94                                ...           8 months ago
  • 3.2.93                                ...           8 months ago
  • 3.2.92                                ...           8 months ago
  • 3.2.90                                ...           8 months ago
  • 3.2.88                                ...           8 months ago
  • 3.2.87                                ...           8 months ago
  • 3.2.86                                ...           8 months ago
  • 3.2.85                                ...           8 months ago
  • 3.2.84                                ...           8 months ago
  • 3.2.83                                ...           8 months ago
  • 3.2.82                                ...           8 months ago
  • 3.2.81                                ...           8 months ago
  • 3.2.79                                ...           8 months ago
  • 3.2.78                                ...           8 months ago
  • 3.2.76                                ...           8 months ago
  • 3.2.7-rc.1                                ...           8 months ago
  • 3.2.74                                ...           8 months ago
  • 3.2.73                                ...           8 months ago
  • 3.2.69-beta.1                                ...           8 months ago
  • 3.2.72                                ...           8 months ago
  • 3.2.69                                ...           8 months ago
  • 3.2.68                                ...           8 months ago
  • 3.2.64-beta.1                                ...           8 months ago
  • 3.2.63                                ...           8 months ago
  • 3.2.61                                ...           8 months ago
  • 3.2.60                                ...           8 months ago
  • 3.2.59                                ...           8 months ago
  • 3.2.54                                ...           8 months ago
  • 3.2.47-beta.8                                ...           8 months ago
  • 3.2.47-beta.7                                ...           8 months ago
  • 3.2.53                                ...           8 months ago
  • 3.2.52                                ...           8 months ago
  • 3.2.51                                ...           8 months ago
  • 3.2.47-beta.6                                ...           8 months ago
  • 3.2.50                                ...           8 months ago
  • 3.2.47-beta.5                                ...           8 months ago
  • 3.2.47-beta.4                                ...           8 months ago
  • 3.2.47-beta.3                                ...           8 months ago
  • 3.2.47-alpha.3                                ...           9 months ago
  • 3.2.47-beta.2                                ...           9 months ago
  • 3.2.47-alpha.2                                ...           9 months ago
  • 3.2.48                                ...           9 months ago
  • 3.2.47-beta.1                                ...           9 months ago
  • 3.2.45-alpha.1                                ...           9 months ago
  • 3.2.47                                ...           9 months ago
  • 3.2.46                                ...           9 months ago
  • 3.2.45-beta.1                                ...           9 months ago
  • 3.2.45-beta.0                                ...           9 months ago
  • 3.2.45                                ...           9 months ago
  • 3.2.44-rc.4                                ...           9 months ago
  • 3.2.44-rc.3                                ...           9 months ago
  • 3.2.44-rc.2                                ...           9 months ago
  • 3.2.44-rc.1                                ...           9 months ago
  • 3.2.44                                ...           9 months ago
  • 3.2.43                                ...           9 months ago
  • 3.2.42                                ...           9 months ago
  • 3.2.41                                ...           9 months ago
  • 3.2.40                                ...           9 months ago
  • 3.2.39                                ...           9 months ago
  • 3.2.37                                ...           9 months ago
  • 3.2.35                                ...           9 months ago
  • 3.2.34                                ...           9 months ago
  • 3.2.33                                ...           9 months ago
  • 3.2.32                                ...           9 months ago
  • 3.2.31                                ...           9 months ago
  • 3.2.30                                ...           9 months ago
  • 3.2.29                                ...           9 months ago
  • 3.2.28                                ...           9 months ago
  • 3.2.27                                ...           9 months ago
  • 3.2.26                                ...           9 months ago
  • 3.2.25                                ...           9 months ago
  • 3.2.24                                ...           9 months ago
  • 3.2.23                                ...           9 months ago
  • 3.2.22                                ...           9 months ago
  • 3.2.21                                ...           9 months ago
  • 3.2.20                                ...           9 months ago
  • 3.2.19                                ...           9 months ago
  • 3.2.18                                ...           9 months ago
  • 3.2.17                                ...           9 months ago
  • 3.2.16                                ...           9 months ago
  • 3.2.15                                ...           9 months ago
  • 3.2.14                                ...           9 months ago
  • 3.2.12                                ...           9 months ago
  • 3.2.10                                ...           9 months ago
  • 3.2.9                                ...           9 months ago
  • 3.2.8                                ...           9 months ago
  • 3.2.7                                ...           9 months ago
  • 3.2.6                                ...           9 months ago
  • 3.2.5                                ...           9 months ago
  • 3.2.4                                ...           9 months ago
  • 3.2.3                                ...           9 months ago
  • 3.2.2                                ...           9 months ago
  • 3.2.1                                ...           9 months ago
  • 3.2.0                                ...           9 months ago
  • 3.1.99                                ...           9 months ago
  • 3.1.98                                ...           9 months ago
  • 3.1.97                                ...           10 months ago
  • 3.1.96                                ...           10 months ago
  • 3.1.95                                ...           10 months ago
  • 3.1.94                                ...           10 months ago
  • 3.1.92                                ...           10 months ago
  • 3.1.91                                ...           10 months ago
  • 3.1.90                                ...           10 months ago
  • 3.1.89                                ...           10 months ago
  • 3.1.88                                ...           10 months ago
  • 3.1.87                                ...           10 months ago
  • 3.1.86                                ...           10 months ago
  • 3.1.85                                ...           10 months ago
  • 3.1.84                                ...           10 months ago
  • 3.1.83                                ...           10 months ago
  • 3.1.82                                ...           10 months ago
  • 3.1.81                                ...           10 months ago
  • 3.1.80                                ...           10 months ago
  • 3.1.79                                ...           10 months ago
  • 3.1.78                                ...           10 months ago
  • 3.1.77                                ...           10 months ago
  • 3.1.76                                ...           10 months ago
  • 3.1.75                                ...           10 months ago
  • 3.1.74                                ...           10 months ago
  • 3.1.73                                ...           10 months ago
  • 3.1.72                                ...           10 months ago
  • 3.1.71                                ...           10 months ago
  • 3.1.70                                ...           10 months ago
  • 3.1.69                                ...           10 months ago
  • 3.1.68                                ...           10 months ago
  • 3.1.67                                ...           10 months ago
  • 3.1.65                                ...           10 months ago
  • 3.1.64                                ...           10 months ago
  • 3.1.63                                ...           10 months ago
  • 3.1.62                                ...           10 months ago
  • 3.1.61                                ...           10 months ago
  • 3.1.60                                ...           10 months ago
  • 3.1.59                                ...           10 months ago
  • 3.1.58                                ...           10 months ago
  • 3.1.57                                ...           10 months ago
  • 3.1.56                                ...           10 months ago
  • 3.1.47                                ...           10 months ago
  • 3.1.46                                ...           10 months ago
  • 3.1.39                                ...           10 months ago
  • 3.1.38                                ...           10 months ago
  • 3.1.37                                ...           10 months ago
  • 3.1.35                                ...           10 months ago
  • 3.1.34                                ...           10 months ago
  • 3.1.33                                ...           10 months ago
  • 3.1.32                                ...           10 months ago
  • 3.1.31                                ...           10 months ago
  • 3.1.30                                ...           10 months ago
  • 3.1.29                                ...           10 months ago
  • 3.1.28                                ...           10 months ago
  • 3.1.21                                ...           10 months ago
  • 3.1.20                                ...           10 months ago
  • 3.1.19                                ...           10 months ago
  • 3.1.18                                ...           10 months ago
  • 3.1.14                                ...           10 months ago
  • 3.1.13                                ...           10 months ago
  • 3.1.12                                ...           10 months ago
  • 3.1.11                                ...           10 months ago
  • 3.1.10                                ...           10 months ago
  • 3.1.9                                ...           10 months ago
  • 3.1.7                                ...           10 months ago
  • 3.1.6                                ...           10 months ago
  • 3.1.5                                ...           10 months ago
  • 3.1.4                                ...           10 months ago
  • 3.1.3                                ...           10 months ago
  • 3.0.90                                ...           10 months ago
  • 3.0.89                                ...           10 months ago
  • 3.0.88                                ...           10 months ago
  • 3.0.87                                ...           10 months ago
  • 3.0.78                                ...           10 months ago
  • 3.0.74                                ...           10 months ago
  • 3.0.69                                ...           10 months ago
  • 3.0.68                                ...           10 months ago
  • 3.0.57                                ...           10 months ago
  • 3.0.56                                ...           10 months ago
  • 3.0.55                                ...           10 months ago
  • 3.0.54                                ...           10 months ago
  • 3.0.53                                ...           10 months ago
  • 3.0.52                                ...           10 months ago
  • 3.0.51                                ...           10 months ago
  • 3.0.49                                ...           10 months ago
  • 3.0.47                                ...           10 months ago
  • 3.0.46                                ...           10 months ago
  • 3.0.45                                ...           10 months ago
  • 3.0.44                                ...           a year ago
  • 3.0.43                                ...           a year ago
  • 3.0.42                                ...           a year ago
  • 3.0.41                                ...           a year ago
  • 3.0.40                                ...           a year ago
  • 3.0.39                                ...           a year ago
  • 3.0.38                                ...           a year ago
  • 3.0.37                                ...           a year ago
  • 3.0.35                                ...           a year ago
  • 3.0.34                                ...           a year ago
  • 3.0.33                                ...           a year ago
  • 3.0.30                                ...           a year ago
  • 3.0.29                                ...           a year ago
  • 3.0.27                                ...           a year ago
  • 3.0.26-rc.1                                ...           a year ago
  • 3.0.26                                ...           a year ago
  • 3.0.25                                ...           a year ago
  • 3.0.24                                ...           a year ago
  • 3.0.23                                ...           a year ago
  • 3.0.22                                ...           a year ago
  • 3.0.20                                ...           a year ago
  • 3.0.19                                ...           a year ago
  • 3.0.18                                ...           a year ago
  • 3.0.17                                ...           a year ago
  • 3.0.16                                ...           a year ago
  • 3.0.3                                ...           a year ago
  • 3.0.1-rc.83                                ...           a year ago
  • 3.0.1-rc.82                                ...           a year ago
  • 3.0.1-rc.81                                ...           a year ago
  • 3.0.1-rc.80                                ...           a year ago
  • 3.0.1-rc.79                                ...           a year ago
  • 3.0.1-rc.78                                ...           a year ago
  • 3.0.1-rc.77                                ...           a year ago
  • 3.0.1-rc.75                                ...           a year ago
  • 3.0.1-rc.74                                ...           a year ago
  • 3.0.1-rc.73                                ...           a year ago
  • 3.0.1-rc.72                                ...           a year ago
  • 3.0.1-rc.71                                ...           a year ago
  • 3.0.1-rc.70                                ...           a year ago
  • 3.0.1-rc.69                                ...           a year ago
  • 3.0.1-rc.68                                ...           a year ago
  • 3.0.1-rc.67                                ...           a year ago
  • 3.0.1-rc.65                                ...           a year ago
  • 3.0.1-rc.64                                ...           a year ago
  • 3.0.1-rc.63                                ...           a year ago
  • 3.0.1-rc.61                                ...           a year ago
  • 3.0.1-rc.59                                ...           a year ago
  • 1.0.37                                ...           a year ago
  • 3.0.1-rc.58                                ...           a year ago
  • 3.0.1-rc.56                                ...           a year ago
  • 3.0.1-rc.54                                ...           a year ago
  • 3.0.1-rc.52                                ...           a year ago
  • 1.0.36                                ...           a year ago
  • 3.0.1-rc.47                                ...           a year ago
  • 3.0.1-rc.44                                ...           a year ago
  • 3.0.1-rc.42                                ...           a year ago
  • 3.0.1-rc.41                                ...           a year ago
  • 3.0.1-rc.40                                ...           a year ago
  • 3.0.1-rc.39                                ...           a year ago
  • 3.0.1-rc.38                                ...           a year ago
  • 3.0.1-rc.37                                ...           a year ago
  • 3.0.1-rc.36                                ...           a year ago
  • 3.0.1-rc.34                                ...           a year ago
  • 3.0.1-rc.32                                ...           a year ago
  • 3.0.1-rc.31                                ...           a year ago
  • 3.0.1-rc.30                                ...           a year ago
  • 3.0.1-rc.28                                ...           a year ago
  • 3.0.1-rc.25                                ...           a year ago
  • 3.0.1-rc.24                                ...           a year ago
  • 3.0.1-rc.22                                ...           a year ago
  • 3.0.1-rc.21                                ...           a year ago
  • 3.0.1-rc.19                                ...           a year ago
  • 3.0.1-rc.18                                ...           a year ago
  • 3.0.1-rc.16                                ...           a year ago
  • 3.0.1-rc.15                                ...           a year ago
  • 3.0.1-rc.13                                ...           a year ago
  • 3.0.1-rc.12                                ...           a year ago
  • 3.0.1-rc.11                                ...           a year ago
  • 3.0.1-rc.10                                ...           a year ago
  • 3.0.1-rc.9                                ...           a year ago
  • 3.0.1-rc.7                                ...           a year ago
  • 3.0.1-rc.6                                ...           a year ago
  • 3.0.1-rc.5                                ...           a year ago
  • 3.0.1-rc.4                                ...           a year ago
  • 3.0.1-rc.2                                ...           a year ago
  • 3.0.1-rc.1                                ...           a year ago
  • 3.0.0-rc.90                                ...           a year ago
  • 3.0.0-rc.86                                ...           a year ago
  • 3.0.0-rc.85                                ...           a year ago
  • 3.0.0-rc.84                                ...           a year ago
  • 3.0.0-rc.81                                ...           a year ago
  • 3.0.0-rc.78                                ...           a year ago
  • 3.0.0-rc.77                                ...           a year ago
  • 3.0.0-rc.76                                ...           a year ago
  • 3.0.0-rc.71                                ...           a year ago
  • 3.0.0-rc.70                                ...           a year ago
  • 3.0.0-rc.69                                ...           a year ago
  • 3.0.0-rc.68                                ...           a year ago
  • 3.0.0-rc.67                                ...           a year ago
  • 3.0.0-rc.65                                ...           a year ago
  • 3.0.0-rc.64                                ...           a year ago
  • 3.0.0-rc.62                                ...           a year ago
  • 3.0.0-rc.61                                ...           a year ago
  • 3.0.0-rc.59                                ...           a year ago
  • 3.0.0-rc.54                                ...           a year ago
  • 3.0.0-rc.47                                ...           a year ago
  • 3.0.0-rc.43                                ...           a year ago
  • 3.0.0-rc.42                                ...           a year ago
  • 3.0.0-rc.41                                ...           a year ago
  • 3.0.0-rc.38                                ...           a year ago
  • 3.0.0-rc.37                                ...           a year ago
  • 3.0.0-rc.35                                ...           a year ago
  • 3.0.0-rc.34                                ...           a year ago
  • 3.0.0-rc.33                                ...           a year ago
  • 3.0.0-rc.32                                ...           a year ago
  • 3.0.0-rc.31                                ...           a year ago
  • 3.0.0-rc.30                                ...           a year ago
  • 3.0.0-rc.29                                ...           a year ago
  • 1.0.35                                ...           a year ago
  • 3.0.0-rc.25                                ...           a year ago
  • 3.0.0-rc.20                                ...           a year ago
  • 1.0.34                                ...           a year ago
  • 1.0.33                                ...           a year ago
  • 1.0.32                                ...           a year ago
  • 1.0.31                                ...           a year ago
  • 1.0.30                                ...           a year ago
  • 1.0.29                                ...           a year ago
  • 1.0.28                                ...           a year ago
  • 1.0.27                                ...           a year ago
  • 1.0.26                                ...           a year ago
  • 1.0.25                                ...           a year ago
  • 1.0.24                                ...           a year ago
  • 1.0.23                                ...           a year ago
  • 1.0.21                                ...           a year ago
  • 1.0.20                                ...           a year ago
  • 1.0.19                                ...           a year ago
  • 1.0.18                                ...           a year ago
  • 1.0.17                                ...           a year ago
  • 1.0.16                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 17
Last Day 1
Last Week 9
Last Month 53
Dependencies (2)
Dev Dependencies (0)
None
Dependents (105)

Copyright 2014 - 2017 © taobao.org |