I want to make my code shorter. I have chart js which is using datacollection to set options for the chart. I want to render it in another component at use it on my pages.
I want to be able to set det data collection from the component render, based on which chart I want.
I have something like this in my component:
<template>
<div>
<chart :datacollection="this_will_i_define_on_the_page_i_render_this_component"> </chart>
</div>
<template>
<script>
export {
name: 'this-chart',
data () {
return {
DC1: []
DC2: []
}
}
}
(basic vue component)
</script>
<template>
<this-chart :datacollection="DC1"> </this-chart>
<this-chart :datacollection="DC2"> </this-chart>
</template>
So I want to be able to go down in my component and set the datacollection. How can I do that?
Thanks in advance.