I have a problem with my project with Vue. when I pass an array as props to my other component, this same one when giving a console.log () it printa an observer, but not the array I passed to it.
this.valores = [1,2,3,4,5];
component:
<spark-line :type="'line'" :data="this.valores" :height="'60'" :width="'100%'" :lineColor="'#1ab394'" :fillColor="'#ffffff'"></spark-line>
But in js the result is an observer, not an array
js:
export default {
props:['type','data','height','width','lineColor','fillColor'],
mounted: function(){
console.log(this.data);
$('#sparkline').sparkline(this.data, {
type: this.type,
width: this.width,
height: this.height,
lineColor: this.lineColor,
fillColor: this.fillColor
});
}
}
Does anyone know what it can be?
But if I put it like this it works:
export default {
props:['type','data','height','width','lineColor','fillColor'],
mounted: function(){
console.log(this.data);
$('#sparkline').sparkline([1,2,3,4], {
type: this.type,
width: this.width,
height: this.height,
lineColor: this.lineColor,
fillColor: this.fillColor
});
}
}