@@ -5,6 +5,7 @@ export default {
5
5
name : 'c-tooltip' ,
6
6
inserted ( el , binding ) {
7
7
binding . def . _tooltip = new Tooltip ( el , binding . def . getTooltipConfig ( binding ) )
8
+ el . _c_tooltip = binding . def . _tooltip
8
9
if ( binding . value . active ) {
9
10
binding . def . _tooltip . show ( )
10
11
}
@@ -14,14 +15,15 @@ export default {
14
15
if ( tooltip ) {
15
16
tooltip . dispose ( )
16
17
tooltip = null
18
+ el . _c_tooltip = null
17
19
}
18
20
} ,
19
21
getTooltipConfig ( binding ) {
20
22
const props = binding . value
21
23
const title = props . content || props
22
- const html = props . html === false ? false : true
24
+ const html = ! ! props . html !== false
23
25
// const modifiersTriggers = String(Object.keys(binding.modifiers)).replace(',',' ')
24
- const closeOnClickOutside = props . closeOnClickOutside === false ? false : true
26
+ const closeOnClickOutside = ! ! props . closeOnClickOutside !== false
25
27
const popperOptions = props . popperOptions || { modifiers : { preventOverflow : { boundariesElement : 'offsetParent' } } }
26
28
return {
27
29
title,
@@ -44,5 +46,15 @@ export default {
44
46
<div class="arrow"></div>
45
47
<div class="tooltip-old-inner"></div>
46
48
</div>`
49
+ } ,
50
+ update ( el , binding , vnode ) {
51
+ if ( binding . value . content !== binding . oldValue . content && el === vnode . elm ) {
52
+ el . _c_tooltip . hide ( )
53
+ vnode . context . $nextTick ( ( ) => {
54
+ const title = binding . value . content
55
+ el . _c_tooltip . updateTitleContent ( title )
56
+ el . _c_tooltip . show ( )
57
+ } )
58
+ }
47
59
}
48
60
}
0 commit comments