Reputation: 277
methods: {
showAlert() {
alert("alert");
}
},
created() {
setTimeout(this.showAlert(), 5000)
}
My codes are in here. I want to set time out in created area. But browser does not see setTimeout. it always runs when the page renders. Its not waiting. How to fix that problem?
Upvotes: 1
Views: 443
Reputation: 1
run the method inside the setTimeout callback like :
created() {
setTimeout(()=>{
this.showAlert()
}, 5000)
}
Upvotes: 2