I would like to call a method in vuejs, like after page load with all plugins. I'm trying to call like this,
mounted: function mounted() {
this.callToLoggedUser();
},
when i try to do like this f7 instance got undefined. Because of calling a method inside the mounted there is no chance for f7 to load before, but after calls by onclick f7 instance is working properly.
callToLoggedUser() {
f7.mainView.router.load({url: '/welcome/'});
}
How to call a method after f7 initialization?
Thanks,
When mounted is called, the DOM is not ready. You should try using nextTick to call after the DOM Operations have been done:
https://v2.vuejs.org/v2/guide/migration.html#ready-replaced
mounted: function () {
this.$nextTick(function () {
this.callToLoggedUser();
})
}
or if you only want to call one function you can use a shorter syntax
mounted: function () {
this.$nextTick(this.callToLoggedUser)
}