antfu / purge-icons

🎐 Bundles icons on demand
https://www.npmjs.com/package/purge-icons
MIT License
228 stars 18 forks source link

v-show and v-if aren't working properly on icons #8

Closed davay42 closed 3 years ago

davay42 commented 3 years ago

Seems like the replacing of the tags with svg leads to v-show and v-if directives not working. It just renders once and then isn't reactive to the changes. Even ` <span class="iconify" :data-icon="myRate.star ? 'la:star-solid' : 'la:star'" data-inline="false"

` isn't reactive...

davay42 commented 3 years ago

Only such a construct worked for me:

` <span class="iconify" data-icon="la:star-solid" data-inline="false"

`

Looks not very clean...

antfu commented 3 years ago

This is a limitation of Iconify's usage. I am using this component wrapping the logic https://github.com/antfu/vitesse/blob/master/src/components/Icon.vue

davay42 commented 3 years ago

I see. Started building a wrapper for my switching purpose. )