Install
npm install debounce
Require in Vue
import debounce from 'debounce';
methods: {
count : debounce( () => {
fetch(`${API_URL}/wp-json/elastic/search/?query=${this.searchQuery}~`)
.then( (response) => response.json() )
.then( (res) => {
console.log('TOTAL RES ', res.hits.total);
this.total = res.hits.total;
}).catch( (err) => console.log('Rejected ',err) );
}, 500 ),
}