No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Q-route-tab with Q-tab-panel: how to set active tab

    Help
    2
    3
    904
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kelly7 last edited by

      I have a button, for jumping to the Q-tab-panels layout, and I made it jumping to the first tab’s page.

      <q-btn round @click="toUser()" unelevated>
      //script
      toUser(){
            this.$router.push({
              name: 'UserInfo',
              params:{ uId: this.uId}
            })
          },
      
      {
              path:'/user',
              component: () => import('layouts/UserLayout'),
              children: [
                {
                  name: 'UserInfo',
                  path: '/user/info/:uId',
                  component: () => import('pages/User/UserInfo')
                },
          ]
      }
      
      <!--the layout page-->
      <q-page>
          <q-splitter
            v-model="splitterModel"
          >
            <template v-slot:before style="width: 30%">
              <q-tabs
                  v-model="routeName"
                  vertical
                  class="text-blue-grey-13"
                  active-color="blue-grey-14"
                >
                  <q-route-tab v-for="r in routeList" :key="r.name" :name="r.name"
                               :to="{name: r.name, params:r.params}" :icon="r.icon" :label="r.label" />
              </q-tabs>
            </template>
      
            <template v-slot:after>
              <q-tab-panels v-model="routeName">
                <q-tab-panel :name="routeName">
                  <router-view />
                </q-tab-panel>
              </q-tab-panels>
            </template>
          </q-splitter>
        </q-page>
      //script
      computed: {
          routeName() {
            return this.$route.name
          },
      }
      

      I clicked the button- the page content was right, but the first tab was not active. Only after I clicking a tab, that tab became active.
      I want to make the first tab active when I click the button.
      Thank you very much.

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @kelly7 last edited by

        @kelly7 routetabs should do this automatically. Try removing

        v-model="routeName"
        

        and

        :name="r.name"
        
        K 1 Reply Last reply Reply Quote 0
        • K
          kelly7 @beets last edited by

          @beets Thank you. But this didn’t work.😢

          1 Reply Last reply Reply Quote 0
          • First post
            Last post