I have an request to get some data and add it to a variable,
When I use:
.then(function(response) {
this.persons = response.data;
});
It does not assign response.data
to this.persons
but when I do the following:
.then(response => this.persons = response.data);
It assigns it fine to use. Please see the js fiddle:
https://jsfiddle.net/trhhtyxr/2/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…