0๐
Iโve figured it out. Using the created hook I also initialised currentPage
with window.location.pathname
, which initialises currentPage
the current URL pathname. My initialising method now looks like
initialise: function() {
if (this.currentPage=="/profile.html") {
this.getNightmode();
this.getProfile();
this.getTaskTypes();
} else if (this.currentPage=="/post_registration.html") {
this.getSignUpMethod();
this.getAccountType();
this.getTaskTypes();
}
}
And this calls the correct initialising methods according to the page.
- [Vuejs]-How to export object of functions to another object of function javascript (nuxt)?
- [Vuejs]-Props being mutated in VueJS
Source:stackexchange.com