How to change title in quasar-toolbar-title?
-
Basically I’d like to change the title of the screen in the quasar-toolbar-title when user selects an other function from the menu. So I have a menu.vue which contains a drawer, a title and menu options in the drawer. Selecting an option triggers a child route in the router.js which then loads the needed component into a router-view also declared in menu.vue.
How can I change the title when each of the vue components have loaded?
I have tried with LocalStorage and now with Events without success. If I have changed the value in the localstorage the variable din’t changed as well so binding was not working as I expected. Then I have tried watching for a change-title event and fire it from the vuew components but now I can’t fire them. Shouldn’t the ready() method be called when the vue component rendered?
-
Hi,
First of all, we’re using Vue 2, so ‘ready()’ has been replaced by ‘mounted()’. Make sure you check this: https://vuejs.org/v2/guide/instance.html#Lifecycle-Diagram
Then, for communicating between components: http://quasar-framework.org/guide/components-sharing-state.html
Long story short: use a store like described in the link or Vuex. Spoiler alert: you’ll need some time to understand how things work.Cheers,
Razvan