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

201
Visualizações
How to use mouseleave event to close Bootstrap-Vue Tooltip

I have a custom color Vue 2 picker component created using a combination of bootstrap-vue button and tooltip components like so:

<template>
    <div>
        <b-button
            ref="button"
            @click="openColors"
            variant="outline-secondary"
            pill
            dusk="tag-colorpicker-button"
            :class="showColorPickerError ? 'button-border' : ''"
        >
            <i :style="{color: color}" class="icon-gt icon-gt-circle"></i>
            <i class="icon-gt icon-gt-angle-down"></i>
        </b-button>
        <div id="tooltip-boundary">
            <b-tooltip
                boundary="window"
                :show.sync="show"
                :target="() => $refs['button']"
                triggers="manual"
                custom-class="colorpicker-tooltip"
                placement="bottom"       
            >
                <compact v-model="color"></compact>
            </b-tooltip>
        </div>

    </div>
</template>

expanded color picker

The issue I'm having is determining how to be able to close the tooltip either by clicking outside of the color picker area. I've tried many iterations of mouse events (e.g. @mouseleave) on the <b-tooltip> component, but they are not triggered. The mouse events are triggered on the <b-button> element, but not the expanded tooltip. In looking at the tooltip component docs, the only thing I can see that might work is border, but I have had no luck there.

I have tried using the `native modifier like so

<b-tooltip
    :show.sync="show"
    :target="() => $refs['button']"
    triggers="manual"
    custom-class="colorpicker-tooltip"
    placement="bottom"
    @mouseleave.native="myMethod"
>

but that is not triggered.

How can I trigger an event on the displayed tooltip area? I know what to do within the event, I just can't figure how to get the native mouse events to be triggered.

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

0

Instead of trigger="manual", do trigger="click blur":

  • click - toggles the tooltip when the target is clicked.
  • blur - closes the tooltip when it is blurred (i.e., loses focus).

demo

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