Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

296
Views
Mouseover drop down menu with Vuejs in Laravel

I am trying to create a simple drop down menu component that opens when the Heading (a button) is hovered over. I am doing this in Laravel 8.4 and Vue 2.

I have two problems:

  1. The mouseenter/mouseleave functionality is not working properly. When I mouse over the button it flickers, opening and closing the dropdown multiple times. Even if I take my hand off the mouse, it just keeps firing off and on while the cursor rests on the button.
  2. Since I have the dropdown menu slightly separated from the button, when I move the mouse down to the actually open menuit will close before the mouse gets to it.

What am I doing wrong in the first case and how do I handle the second?

Dropdown.vue

<template>
    <div class="relative">
        <div
            @mouseenter="open = true"
            @mouseleave="open = false"
        >
            <slot name="trigger"/>
            <i :class="{'fa fa-chevron-up':upArrow, 'fa fa-chevron-down':downArrow}"
            />
        </div>

        <div  v-show="open"
                style="display: none;"
                @click="open = false"
        >
            <div class="dropdown-menu">
                <slot name="content"/>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                open: false,
            }
        },
    }
</script>

calling component

    <div class="mt-1">
        <dropdown>
            <template #trigger>
                <button class="tab-title">
                    PEOPLE
                </button>
            </template>

            <template #content>
                <dropdown-link href="">
                    Alice
                <dropdown-link>
                <dropdown-link href="">
                    Bob
                <dropdown-link>
                <dropdown-link href="">
                    Charles
                <dropdown-link>
            </template>
        <dropdown>
    </div>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!