user3757488 user3757488 - 1 year ago 121
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


Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download