unplugin / unplugin-icons

šŸ¤¹ Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
4.13k stars 144 forks source link

Events don't fire in Vue 2 #329

Closed bmulholland closed 7 months ago

bmulholland commented 1 year ago

Describe the bug

At least @click doesn't work

I haven't tried other events but this is certainly enough to dig in.

Reproduction

https://stackblitz.com/edit/unplugin-unplugin-icons-pcienm?file=src%2FApp.vue

Re-filing https://github.com/unplugin/unplugin-icons/issues/196 with a minimal repro. All I did was take the vue 2 example, add @click on an icon, and wrap the other icon in a div with the same @click.

To see the issue:

  1. Open console
  2. click the first icon, see that nothing happens
  3. click the second icon, with the wrapped div, see that console DOES fire

System Info

https://stackblitz.com/edit/unplugin-unplugin-icons-pcienm?file=src%2FApp.vue

Used Package Manager

pnpm

Validations

stackblitz[bot] commented 1 year ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

RayGuo-ergou commented 11 months ago

image I don't see any issue here from the repo you provided.

bmulholland commented 11 months ago

@RayGuo-ergou which icon did you click on? One of them I wrapped in a div to show that clicks fire on that one.

I've updated the example to be clear about that: https://stackblitz.com/edit/unplugin-unplugin-icons-pcienm

RayGuo-ergou commented 11 months ago

My apologies, did not check the description carefully. In that case you can use @click.native to fire the event. More information from vue documentation

bmulholland commented 11 months ago

Well sure, that's a workaround, but that's not my expectation when I switched to this library. Click worked on the icon element I had before, I'd expect it to work here too.

Anyway, I upgraded to Vue 3 so this doesn't affect me. If you think it's something that isn't worth fixing for others, go ahead and close.