debian-mirror-gitlab/app/assets/javascripts/vue_shared/directives/tooltip.js

26 lines
493 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2017-09-10 17:25:29 +05:30
export default {
bind(el) {
2018-11-08 19:23:39 +05:30
$(el).tooltip({
trigger: 'hover',
});
2017-09-10 17:25:29 +05:30
},
componentUpdated(el) {
2018-11-08 19:23:39 +05:30
$(el).tooltip('_fixTitle');
2018-12-13 13:39:08 +05:30
// update visible tooltips
const tooltipInstance = $(el).data('bs.tooltip');
const tip = tooltipInstance.getTipElement();
tooltipInstance.setElementContent(
$(tip.querySelectorAll('.tooltip-inner')),
tooltipInstance.getTitle(),
);
2017-09-10 17:25:29 +05:30
},
unbind(el) {
2018-11-08 19:23:39 +05:30
$(el).tooltip('dispose');
2017-09-10 17:25:29 +05:30
},
};