Reputation: 8484
I want to generate svg compoenents which uses svg tags. Does Vue supports that?
Note, that svg elements needs to be created in the corretc namespace and vue might not be able to handle that out of the box
Upvotes: 0
Views: 453
Reputation: 4327
Yes, you can use Vue to create dynamic SVGs. There even is an example in the docs. In this podcast, Sarah Drasner talks about the combination of Vue, SVG and https://greensock.com/.
I have used this approach to build https://fn.hofmann-vratny.de/configurator, which simply binds SVG elements/properties to reactive Vue data. This worked really well for me.
Upvotes: 2
Reputation: 9
You can create a component and add the SVG tags inside like:
<template> SVG Content Here </template>
Note: You might find some issues with certain SVG tags.
There's also some libraries you can use like svg-to-vue-component
Hope this helps.
Upvotes: 0