Passing Ionicon name as props and using it in child component

264 views Asked by At

So I am building an Ionic App with Vue, and I just happen to get stuck on this one particular problem. where I am receiving an array of objects, and one of the field in that object is icon-name,

Now what I don't know or rather have an issue with is how do I use that icon-name field to show the desired icon

As Per documentation, One of the way is that I can add a <script src> tag inside of the Index.html and then use name={{item.icon-name}} but the problem here is that I get the following error in the browser console

Failed to load module The server responded with a non-JavaScript MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.

Second way is that i Import {iconName} from "ionicons/icons" and return it in data() in this way the issue is I do not know first hand what icon-name will be passed to me in the array.

Please Suggest..

0

There are 0 answers