pakholeung37 / vite-plugin-vue2-svg

load SVG files as Vue components, for Vue2.x only.
MIT License
19 stars 9 forks source link

Add event listeners #3

Closed jcushman closed 2 years ago

jcushman commented 2 years ago

The webpack svg loader vue-svg-loader allows event handling on svgs in templates like this:

<MySVG @click="myClickEvent" @mouseover="myMouseoverEvent" />

I think it works through this line:

svg = svg.replace('<svg', '<svg v-on="$listeners"');

Could this loader add the same feature?

pakholeung37 commented 2 years ago

close #5