0

I'm currently working on a Vue.js project and have encountered an issue with a custom menu component. The menu is supposed to handle sorting types, and I'm using it in conjunction with a method (setSortingType) to update the sorting type when an item is selected. However, I'm facing a problem where the selected property in the event object ($event) is not behaving as expected

<menu
    ref="MenuRef"
    :items="SortTypes"
    target="#sorting-button"
    position="center"
    @clicked-away="isButtonClicked = !isButtonClicked"
    @selected="setSortingType"
/>

const SortTypes = [{labek: 'l1'}, {label: 'l2'}]

setSortingType($event) {
    // some code
}

The dropdown is properly displaying the items. and I was able to click them. But if I select the item1 initially and then if I open dropdown and click on the item2, the dropdown is closing (which is fine).

But when I select the item1 and then if I open dropdown and click on the same item1 again, it's not closing the dropdown. It's not even calling the method mentioned in @selected event.

I even tried with @click. Still not working. Where am I doing wrong.

3
  • 2
    It depends on how the custom component works, which we have no idea. Please add the relevant code of the menu component, specifically the code that shows how these different events fire. Commented Jan 17, 2024 at 20:12
  • Please provide a minimal reproducible example. Commented Jan 17, 2024 at 22:24
  • The main app was using a shared library. I had to update it. No issues now. Commented Jan 23, 2024 at 6:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.