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

561
Visualizações
TypeError: binding.value is not a function Vue js v-click-outside

i am using v-click-outside and want to pass value to the function but i am having error

enter image description here

enter image description here

This is how i am passing a value enter image description here

Here is my code from Main.js file

vue_app.directive('click-outside', {
    beforeMount(el, binding, vnode) {
        el.clickOutsideEvent = evt => {
            evt.stopPropagation()
            if (!(el === evt.target || el.contains(evt.target))) {
                binding.value(evt, el)
            }
        }
        // Wait 1 frame otherwise a potential click that mounted the element will immediately trigger a click-outside event:
        window.requestAnimationFrame(() => {
            document.addEventListener('click', el.clickOutsideEvent)
        })
    },
    unmounted(el) {
        document.removeEventListener('click', el.clickOutsideEvent)
    },
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have to pass a function to the directive, but right now you call it right away and pass the returned value. So instead of

v-click-outside="hideAllShowDetailDropdown(show.show_ID)"

Try this:

v-click-outside="() => hideAllShowDetailDropdown(show.show_ID)"
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