Incorporating a component named CanvasComp from my components folder, I am rendering it on the template like
<CanvasComp :jsoData="data"/>
to send jsonData to the component. However, I am seeking a way to dynamically render this component without manually displaying it on the template and pass the jsonData dynamically as well. Here is my current implementation:
<template>
<ion-page id="main-content">
<CanvasComp :jsoData="data"/>
</ion-page>
</template>
<script lang="ts">
import { defineComponent, onBeforeMount, onMounted, ref, watch, watchEffect, reactive, computed } from "vue";
import { IonContent,IonPage } from "@ionic/vue";
import CanvasComp from "@/components/CanvasComp.vue";
export default defineComponent({
name: "GraphView",
components: {
IonContent,
IonPage,
CanvasComp,
},
setup() {
const data= [
{ id: 1, name: 'Default' },
{ id: 2, name: 'Demographics'},
{ id: 3, name: 'Other'},
];
}
return { data, CanvasComp }
</script>
Exploring if there is a method to dynamically render
<CanvasComp :jsoData="data"/>
in the template while passing the jsonData, for example like const CanvasComp = prop{jsonData: data};
then returning it.