I’ve set up my layout with tabs for navigating subroutes as per http://quasar-framework.org/components/tabs.html.
I have it set up like this:
<template>
<q-layout ref="layout" view="hHh Lpr lFf">
<router-view />
<q-tabs slot="footer" inverted class="bg-white">
<q-route-tab default to="team" slot="title" name="tab-1" icon="list" label="My Team" />
<q-route-tab to="league" slot="title" name="tab-2" icon="star" label="League" />
<q-route-tab to="draft" slot="title" name="tab-3" icon="view_comfy" label="Draft"/>
<q-route-tab to="players" slot="title" name="tab-4" icon="person" label="Players" />
</q-tabs>
</q-layout>
</template>
My issue is that I want to perform an api call to load data on each subroute. I have it set up as per here: https://router.vuejs.org/en/advanced/data-fetching.html. I want to fetch data after navigation. So the desired behavior is that when I click a tab, the tab (and route) becomes active, a loading spinner is shown until the data is loaded. I followed the recommendations on the vue router page, and my subroutes contain this (as well as a method that calls my api to fetch data):
created () {
// fetch the data when the view is created and the data is
// already being observed
this.fetchData()
}
I also call the quasar “Loading” component in my fetchdata method. My problem is that it seems like the navigation doesn’t happen until after the data is loaded. When I click a tab, theres a pause for about 1-2 seconds, then the new tab becomes active. I never see the Loading spinner.
Is this an issue with quasar, or vue-router? Am I just doing something wrong somewhere?