Hi,
Today, i we will show you how to call function on load in vue js. This article will give you simple example of how to call function on load in vue js. you will learn how to call function on load in vue js. So let’s follow few step to create example of how to call function on load in vue js.
Example:
<!DOCTYPE html> <html> <head> <title>How To Call Function On Load in Vue JS </title> <script src="https://cdn.jsdelivr.net/npm/vue"></script> </head> <body> <div id="app"> {{ message }} </div> <script type="text/javascript"> var app = new Vue({ el: '#app', data: { message: 'Hello Vue!' }, methods:{ myFunctionOnLoad: function() { console.log('call on load...'); } }, created: function(){ this.myFunctionOnLoad() } }) </script> </body> </html>
I hope it will assist you…