robcresswell / vue-material-design-icons

Material Design Icons as Vue Single File Components
https://npmjs.com/vue-material-design-icons
MIT License
162 stars 35 forks source link

[Vue 3] click event fires twice #276

Closed ibrahim-sakr closed 1 year ago

ibrahim-sakr commented 2 years ago

when using Vue 3 and because Vue 3 changed the way that events passed to a component. see Fallthrough Doc

you will face a click event fires twice when you use it like this <menu-icon @click="someFunc" /> in this case, someFunc will always run twice

the reason for this is the @click in the lib components definitions.

for Vue 3 this @click here <span @click="$emit('click', $event)"> should be removed and Vue will handle the events automatically or perhaps the attribute inheritAttrs: false should be used instead for the compatibility with Vue 2

robcresswell commented 2 years ago

Oh nice catch, thanks for this. I'll take a look at the weekend and decide on a solution

robcresswell commented 1 year ago

This was fixed by https://github.com/robcresswell/vue-material-design-icons/commit/2f08947dbf7d23df5a38f21491651da3d5f9ceea but I forgot to close it. Thanks!