I am trying to access data value reviews into scroll method . Consoled reviews by console.log(this.reviews). but it always returns undifined;
data() {
return {
m: '',
rating: '',
review: '',
visibility: '',
reviews: [],
page: 1,
};
},
scroll (page) {
$('#profile-edits-more').on("scroll", function() {
if(jQuery(this).scrollTop() + jQuery(this).innerHeight() >= this.scrollHeight) {
var vm = this;
axios.post('./fetch-reviews?page='+page, {
m: vm.m,
})
.then(response => {
page +=1;
console.log(this.reviews);
});
}
});
},