Hello community,
www/pages
www/scripts
- www/pages/progress-tracker.html
//my template here, then respected script as below
return {
data:function(){
return{
items:null,
loading:true
}
},
on: {
pageInit: function () {
var app = this.$app;
var $$ = Dom7;
var self = this;
var router = this.$router;
progresstracker(); // this function called from another JS file
}
}
}
- www/scripts/progress-tracker.js
function progresstracker(){
// my API CALLS
app.request({
url: apiUrl,
method:‘GET’,
async:false,
dataType:‘json’,
sucess:(data)=>{
data.map((newData)=>{
items.push({ // added new items successfully
})
})
// issue on line below
self.$setState({
items:items
})
}
});
}
- Issue:
uncaught TypeError : self.$setState is not function