how to use the onload event n vue js
vm=new Vue({
el:"#app",
mounted:function(){
this.method1() //method1 will execute at pageload
},
methods:{
method1:function(){
/* your logic */
}
},
})
how to use the onload event n vue js
vm=new Vue({
el:"#app",
mounted:function(){
this.method1() //method1 will execute at pageload
},
methods:{
method1:function(){
/* your logic */
}
},
})
onload vue
methods: {
getUnits: function() {...}
},
beforeMount() {
this.getUnits()
}
________________________________________________________________________________
beforeCreate: Called synchronously after the instance has just been initialized,
before data observation and event/watcher setup.
created: Called synchronously after the instance is created. At this stage,
the instance has finished processing the options which means the following have been set up: data observation, computed properties, methods, watch/event callbacks. However, the mounting phase has not been started, and the $el property will not be available yet.
beforeMount: Called right before the mounting begins: the render function is
about to be called for the first time.
mounted: Called after the instance has just been mounted where el is replaced
by the newly created vm.$el.
beforeUpdate: Called when the data changes, before the virtual DOM is
re-rendered and patched.
updated: Called after a data change causes the virtual DOM to be re-rendered
and patched.
You can have a look at complete list here:
https://vuejs.org/v2/api/#Options-Lifecycle-Hooks
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us