0👍
is it compulsory that you use <slot>
?
Vue comes with a directive called <component>
for loading components dinamically, you can pass your component using the is
special attribute.
<template>
<div>
<component :is="dynamicComponent">
</div>
</template>
The script:
export default {
computed: {
dynamicComponent(){
return Comp2 //the class, not the instance
}
}
}
Source:stackexchange.com