How to call function on page load in Vue JS?

If you are finding way to run function when page load then, this tutorial will help to do that. sometimes you may require to write some code or function code on vue js and you must require to load when your page is load. so we can do it using created parameter in vue js. So let's just see bellow full example code.


<!DOCTYPE html>



<title>How to call function on page load in Vue JS?- HDTuto.com</title>

<script src="https://cdn.jsdelivr.net/npm/vue"></script>



<div id="app">

{{ message }}


<script type="text/javascript">

var app = new Vue({

el: '#app',

data: {

message: 'Hello Vue!'



myFunctionOnLoad: function() {

console.log('call on load...');



created: function(){







I hope you found your solution...

June 24, 2018 | Category : Vue.js
Related Posts

Blog Search