File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ class ReactTooltip extends Component {
37
37
eventOff : PropTypes . string ,
38
38
watchWindow : PropTypes . bool ,
39
39
isCapture : PropTypes . bool ,
40
- globalEventOff : PropTypes . string
40
+ globalEventOff : PropTypes . string ,
41
+ getContent : PropTypes . func
41
42
}
42
43
43
44
constructor ( props ) {
@@ -165,10 +166,18 @@ class ReactTooltip extends Component {
165
166
showTooltip ( e ) {
166
167
// Get the tooltip content
167
168
// calculate in this phrase so that tip width height can be detected
168
- const { children, multiline} = this . props
169
+ const { children, multiline, getContent } = this . props
169
170
const originTooltip = e . currentTarget . getAttribute ( 'data-tip' )
170
171
const isMultiline = e . currentTarget . getAttribute ( 'data-multiline' ) || multiline || false
171
- const placeholder = getTipContent ( originTooltip , children , isMultiline )
172
+
173
+ let content
174
+ if ( children ) {
175
+ content = children
176
+ } else if ( getContent ) {
177
+ content = getContent ( )
178
+ }
179
+
180
+ const placeholder = getTipContent ( originTooltip , content , isMultiline )
172
181
173
182
this . setState ( {
174
183
placeholder,
You can’t perform that action at this time.
0 commit comments