How to abandon the previous request using axios, in vue

axios the following forms are injected into vue

const asiosInstance = axios.create({
    baseURL: apiUrl,
    timeout: 10000
})
Vue.prototype.$http = asiosInstance

use it as follows

this.$http.get("xx").then()

my current scenario is that there is a filtering feature in which the filter conditions change when the user clicks, and then requests data immediately, but the backend interface is very slow abroad, and when the user clicks quickly, multiple requests are initiated. When these requests respond, the page will appear how many refresh data, which feels very uncomfortable.
so I think the current this.$http.get ("xx") ignores the previous request each time, while other locations, such as this.$http.get (" yy") , are not affected,

.
Mar.10,2021

look at axios's cancelToken


the easiest thing to do is to mark

with a variable.
...
if(this.requesting){
    this.requesting = false;
    this.$http.get('xx').then(()=>{
        this.requesting = true;
        ...
    });
}
Menu