[Vuejs]-New data to array

2👍

Change your addData() method to accept two parameters, the data and the dimension to which to push. Then it should look like the following:

addData(mData, mDimension) {
  this.dimensions.forEach((dimension) => {
    if (dimension['title'] === mDimension) {
      dimension['data'].push(parseInt(mData));
    }
  });
}

Don’t forget to pass the data and dimension in your method call.

👤Matt

Leave a comment