There seems to be an issue where a function is being called from mounted()
, but when the elements are loaded, the same function is also called again, interrupting the first call and preventing it from completing the entire process.
<b-table
id="my-table"
:items="getList"
:per-page="perPage"
:current-page="currentPage"
small
></b-table>
mounted() {
this.getList();
},
methods: {
getList(ctx){
return axios.get(url)
.then(
function(response) {
this.totalRows = response.data.count;
return response.data.results;
}.bind(this)
)
.catch(function(error) {
console.log(error);
return [];
});
}
}
Upon loading the page, I need to initialize the value of totalRows
, but it seems that the first call from mounted() is not completing properly. This results in the assignment of totalRows
value not taking place. The assignment only happens when the second call is made from the b-table
. However, I require the value of totalRows
to be set before the second call is triggered. Is there a way to resolve this issue?