Hello from a child component in Vue.js. I am facing an issue while trying to pass data from the parent via sensorData
. The problem lies in the fact that the arrow function used for data
below is causing the binding not to occur as expected. Can anyone guide me on how to convert this function into a regular one so that the correct this
binding can take place?
export default {
name: "SensorChart",
props: ["sensorData"],
data() {
return {
chartOptionsLine: {
xAxis: {
data: ["A", "B", "C", "D", "E", "F", "G"]
},
yAxis: {
type: "value"
},
series: [
{
type: "line",
// data: this.sensorData
data: [910, 423, 61, 752, 262, 3625, 119]
}
],
title: {
text: "Sample Data",
x: "center",
textStyle: {
fontSize: 20
}
},
color: ["#1271c2"]
}
};
}
};