vue-simple-search-dropdown icon indicating copy to clipboard operation
vue-simple-search-dropdown copied to clipboard

Selected event is emitted twice

Open lukqw opened this issue 6 years ago • 2 comments

I got a problem which I've also tested on https://romainsimon.github.io/vue-simple-search-dropdown/

When you select an entry with left clicking your mouse, "X has been selected" is printed twice. Therefore I assume that (for whatever reason) the select event is emitted twice. Is there an easy fix for that?

lukqw avatar Dec 11 '19 14:12 lukqw

It looks like the selected event gets emitted two places in the code:

  1. When the text input loses focus (exit method gets called which emits selected)
  2. When a dropdown option is clicked

I ended up just copying the component into my project and removing the line that emits in exit() and that fixed it for my use case at least: https://github.com/romainsimon/vue-simple-search-dropdown/blob/master/src/Dropdown.vue#L106

0x300 avatar Dec 20 '19 02:12 0x300

Thanks man, I ended up fixing it the same way as you - removing the emit line in exit()

lukqw avatar Jan 01 '20 20:01 lukqw