Answer the question
In order to leave comments, you need to log in
How to run any function while receiving data from the server?
The vue component receives data once a minute, after which it is updated in the component itself. I want to make a spinner on the block when the data is updated, then when the new data is displayed, hide it.
That is, the idea is this:
1. the first render of the component with data occurs
2. the method is executed through:setInterval(func,60000);
requestData: function (currency) {
// console.log(currency);
axios
.get('/api/capitalization/' + currency)
.then(response => {
// Пишем parse, потому что из базы берется сразу JSON с слешами "\"
this.info = JSON.parse(response.data);
console.log(this.info);
});
}
Answer the question
In order to leave comments, you need to log in
isLoading
Let the
flag take values either false
or true
(when loading is in progress).
Show/hide spinner viav-if="isLoading"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question