1👍
✅
In onClick: function(evt, array) { }
, this
is the Chart
instance. To bind the context to the Vue instance, use an arrow function:
this._chart = new Chart({
onClick: (evt, array) => {
...
console.log(this.id[position])
}
)
2👍
Use this
when referring to a variable from your component’s data
and props
attribute.
So instead of:
window.open("/#/user/history/detail/" + id[position], "_self");
Use:
window.open("/#/user/history/detail/" + this.id[position], "_self");
Source:stackexchange.com