My goal is to dynamically load a component with the name retrieved from the database, however, I keep encountering the error [Vue warn]: Component is missing template or render function.
import SimpleQuestions from '@/components/SimpleQuestions.vue';
const templates = {
SimpleQuestions,
}
const getMissionComponent = async (name) =>{
let missionInfo = await userStore.getMissionInfo(email.value, roomID.value, name);
let templateName = missionInfo.template;
switch (templateName){
case 'SimpleQuestions':
return templates[templateName];
<div v-for="(mission, index) in missions" :key="index">
<component :is="getMissionComponent(mission)"></component>
</div>
When I directly input 'SimpleQuestions' in the :is attribute, the component is detected and loaded successfully, but when using the function, it does not work. Can anyone shed light on why this might be happening?