@@ -5,6 +5,7 @@ export default {
55 name : 'c-tooltip' ,
66 inserted ( el , binding ) {
77 binding . def . _tooltip = new Tooltip ( el , binding . def . getTooltipConfig ( binding ) )
8+ el . _c_tooltip = binding . def . _tooltip
89 if ( binding . value . active ) {
910 binding . def . _tooltip . show ( )
1011 }
@@ -14,14 +15,15 @@ export default {
1415 if ( tooltip ) {
1516 tooltip . dispose ( )
1617 tooltip = null
18+ el . _c_tooltip = null
1719 }
1820 } ,
1921 getTooltipConfig ( binding ) {
2022 const props = binding . value
2123 const title = props . content || props
22- const html = props . html === false ? false : true
24+ const html = ! ! props . html !== false
2325 // const modifiersTriggers = String(Object.keys(binding.modifiers)).replace(',',' ')
24- const closeOnClickOutside = props . closeOnClickOutside === false ? false : true
26+ const closeOnClickOutside = ! ! props . closeOnClickOutside !== false
2527 const popperOptions = props . popperOptions || { modifiers : { preventOverflow : { boundariesElement : 'offsetParent' } } }
2628 return {
2729 title,
@@ -44,5 +46,15 @@ export default {
4446 <div class="arrow"></div>
4547 <div class="tooltip-old-inner"></div>
4648 </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+ }
4759 }
4860}
0 commit comments