Is it possible to have dynamic element names in a Vue template?

Viewed 140

I need to have a component, where I get the type of another component that this component should create. (it could be one of n different elements) Doing this in the component's render function is not a problem, but since I am new to Vue and I am trying to do things the Vue way, not the way I would do it in React.

I have not been able to find any solution with just using a Vue template. Is there one?

This is how I would like to be able to use the component:

<factory elm="first-component"></factory>

The factory should then internally in some way result in this:

<first-component></first-component>

(it should also be able to add attributes to the component, but that I know how to do, so a suggested solution does not need to care about attributes)

1 Answers
Related