引导程序的工具提示并不总是加载

时间:2021-02-20 21:48:03

标签: javascript html css vue.js bootstrap-4

当我想使用引导程序中的工具提示时遇到问题,有时它可以正常工作并正确显示,有时它根本不显示,好像没有加载某些东西。我正在尝试将它与 Vue.js 一起使用,我不明白为什么它不起作用。

我在 index.html 文件中加载 bootstrap,我想在组件中使用它。 这是按钮的声明,我想要工具提示:

<button data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="Scoate gradul de producator" style="margin-left: 10px;" v-if="user.producer === 1" class="btn btn-danger btn-modal" type="button" v-on:click="cancelProducer(user.id)"><span class="material-icons">do_disturb</span></button>

这就是我加载工具提示的方式:

// eslint-disable-next-line no-undef
$(document).ready(function(){
  // eslint-disable-next-line no-undef
  $('[data-toggle="tooltip"]').tooltip();
  // eslint-disable-next-line no-undef
  $('[data-tooltip="tooltip"]').tooltip();
});

我把它放在mounted()之前。

预先感谢您的回答和想法。

0 个答案:

没有答案
相关问题