I am attempting to incorporate the debounce
function into my filter. The goal is to avoid sending a request with each change in input text, and instead, wait for about one second.
However, I'm encountering an issue where the filter doesn't seem to be triggered at all when using _.debounce.
<div class="md-form">
<i class="fas fa-search prefix"></i>
<input type="text" class="form-control" v-model="filter.fulltext" @input="runFilter" id="x">
<label for="x">Fulltext search</label>
</div>
var app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
data: { ....
methods:{
runFilter() {
var self = this;
_.debounce(function () {
self.records_page = 1;
self.loadRecords();
self.loadMarkers();
}, 1000)
},
....
Any idea why the function is not being triggered after one second?