user3757488 user3757488 - 27 days ago 7x
jQuery Question

how set timeout in method vueJs

hy all, I have quetion about vueJs

how I can settimeout in method vueJs, I have try like this but dosent work

fetchHole: function () { //get data },

addHole: function () {
//my query add new
setTimeout(function () { this.fetchHole() }, 1000)

and for msg error : Uncaught TypeError: this.fetchHole is not a function



Try this: setTimeout(this.fetchHole, 1000) because this in anonymous function is attached to that anonymous function not to your main function