[Vuejs]-Pass component as prop in object param

0👍

One option is to pass card.icon as a string, such as 'BeakerIcon' and do

<div class="rounded-full p-4 bg-gradient-to-r from-prospire-blue to-prospire-light-blue">
  <component :is="card.icon" />
</div>

…granted the icon you pass has been registered as a component.

It also work without registering the component globally.

Here is an example on sfc.vuejs.org passing the imported components in the props.

Leave a comment