Dynamic q-toolbar - what's the best idea? (0.15)



  • Hi, is there a standard or best way to make dynamically changing q-toolbar according to pages being displayed? This is for Quasar v0.15. Obviously I’m newbie 🙂

    TQ



  • Within the routes you may add some meta data like:

      { path: 'test/public',
        component: () => import('pages/test/public'),
        meta: { title: 'Public Test Page' } },
    

    Within the layout or page you can then use this meta data like:

        <q-toolbar-title>
          {{ $route.meta.title }}
        </q-toolbar-title>
    

    So if the route changes, the title will also change.



  • How about things like back button, menu icon and other stuff like search field…



  • You can access the route object from within your component with this.$route
    Then you can use this to display stuff depending on your route