I'm new to vuejs and I have a problem where the I have a parent component with a couple of child components who swap in and out using <component :is="view">
where view
is the parent component's property. The problem is that each child components has to be populated with different datasets stored in the parent component...thus
parent component
<template>
<component :is="view"></component>
</template>
export default {
props: ["view"],
data() { return {data1:[..], data2:[...], ... } }
components : {
"view1" : View1,
"view2" : View2,
"view3" : View3
}
}
So when view is view1 then use data1, view is view2 use data2 etc...
can I there for use some sync data in the child component's template?
child component template
<template>
<div class="child" v-for"data in data1" :data1="data1">
{{* data}}
</div>
</template>
What about using partials? I did not see much documentation on it can someone elaborate on its use as opposed to components?