debian-mirror-gitlab/app/assets/javascripts/vue_shared/directives/tooltip.js
2019-07-31 17:26:46 +00:00

26 lines
523 B
JavaScript

import $ from 'jquery';
import '~/commons/bootstrap';
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');
},
};