Tell me please, how in DATA to write data from the AJAX response? Example:
var example = new Vue({
el: '#example',
data:{
myArr: []
},
created: function () {
$.getJSON('data.json', function(data) {
this.myArr = data;
});
}
});
The problem is that in myArr, the response data is not written. How to solve this? Thank you.
this.$set(this.myArr, data)Here are docs: vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats