@@ -5,6 +5,7 @@ export default {
55name :'c-tooltip' ,
66inserted ( el , binding ) {
77binding . def . _tooltip = new Tooltip ( el , binding . def . getTooltipConfig ( binding ) )
8+ el . _c_tooltip = binding . def . _tooltip
89if ( binding . value . active ) {
910binding . def . _tooltip . show ( )
1011}
@@ -14,14 +15,15 @@ export default {
1415if ( tooltip ) {
1516tooltip . dispose ( )
1617tooltip = null
18+ el . _c_tooltip = null
1719}
1820} ,
1921getTooltipConfig ( binding ) {
2022const props = binding . value
2123const 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
2527const popperOptions = props . popperOptions || { modifiers :{ preventOverflow :{ boundariesElement :'offsetParent' } } }
2628return {
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}