debian-mirror-gitlab/app/assets/javascripts/vue_shared/directives/tooltip.js
2018-12-13 13:39:08 +05:30

25 lines
493 B
JavaScript

import $ from 'jquery';
export default {
bind(el) {
$(el).tooltip({
trigger: 'hover',
});
},
componentUpdated(el) {
$(el).tooltip('_fixTitle');
// update visible tooltips
const tooltipInstance = $(el).data('bs.tooltip');
const tip = tooltipInstance.getTipElement();
tooltipInstance.setElementContent(
$(tip.querySelectorAll('.tooltip-inner')),
tooltipInstance.getTitle(),
);
},
unbind(el) {
$(el).tooltip('dispose');
},
};