Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
How to only show Bootstrap tooltip on click only inside Vue Component? (hide on hover)

I am using Bootstrap ToolTip to display notice only when the button is clicked, inside Vue component. However, the tooltip still show when on hover, which is unintended. I've tried to use jQuery inside the vue component to achieve the result but failed. May I ask how to show Bootstrap tooltip on click only?

const linkButton = {
  props: ["url"],
  data() {
    return {
      toolTipTitle: "Link Copied",
      currentUrl: this.url,
    };
  },
  methods: {
    copy: function () {
      var copyText = document.getElementById("myInput");
      // copyText.value = window.location.href
      copyText.select();
      copyText.setSelectionRange(0, 99999);
      document.execCommand("copy");
      console.log(copyText.value);
    },
    toolTipClicked: function () {
      this.copy();
      console.log("Tool Tip Clicked");
    },
  },
  template: /*html*/ `
    <a @click.prevent="toolTipClicked"  class="ml-4" href="#" id="tooltipLink" data-toggle="tooltip" :title="toolTipTitle">  
        <svg width="21" height="21" viewBox="0 0 21 21" fill="none" 
        xmlns="http://www.w3.org/2000/svg"> ... </svg>
    </a>
    <input type="text" style="position: absolute; left: -1000px; top: -1000px" :value="currentUrl" id="myInput">
    `,
};


about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Further information: For the tooltip to disappear automatically, I've used the following method:

tooltipLink.addEventListener("click", () => {
      setTimeout(() => {
        $("#tooltipLink").tooltip("hide");
      }, 1500);
    }); 

Hope it also helps others facing the same problem

about 4 years ago · Juan Pablo Isaza Relatório

0

try this:

mounted() {
    $(document).ready(function () {
        $(“#tooltipLink”).tooltip({
            trigger: “click”,
        });
    });
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda