We will learn How to use setTimeout in Vue JS?
Example:
<!DOCTYPE html>
<html>
<head>
<title>How to use setTimeout in Vue JS? - rathorji.in</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
{{ message }}
</div>
</body>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
message:"Welcome, Please Wait...."
},
methods:{
callFunction: function () {
var v = this;
setTimeout(function () {
v.message = "Hi Bro, SetTimeout is working fine.";
}, 3000);
}
},
mounted () {
this.callFunction()
}
});
</script>
</html>