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

    can't understand q-tab component

    Framework
    5
    9
    4253
    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.
    • A
      alexe2baranov last edited by

      I try to output tariffs inside tabs component like this but unsuccessfully. Can you tell me where is my mistake please

      <q-tabs :refs="$refs" v-model="TARIFF">
        <q-tab v-for="eachTariff in tariffs" :name="'tab'+eachTariff.value" icon="message" >
          {{eachTariff.label}}
        </q-tab>
      </q-tabs>
      <!-- Targets -->
      <div v-for="eachTariff in tariffs" :ref="'tab'+eachTariff.value">
        {{eachTariff.description}}
      </div>
      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Hi. Here’s an example: https://github.com/quasarframework/quasar-play/blob/master/src/components/showcase/layout/tabs.vue

        1 Reply Last reply Reply Quote 0
        • A
          alexe2baranov last edited by

          @rstoenescu
          yes I see it. i tryed this example and it works very well. but i need dynamic tabs. can you explain me why my code nod works?

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            I’d like to know this too, as I’d like to implement a dynamic navigation at some point.

            Scott

            1 Reply Last reply Reply Quote 0
            • A
              alexe2baranov last edited by

              <q-tabs :refs="$refs" v-model=“TARIFF”>
              <q-tab v-for=“eachTariff in tariffs” :name="‘tab’+eachTariff.value" icon=“message” >
              {{eachTariff.label}}
              </q-tab>
              </q-tabs>
              <!-- Targets -->
              <div v-for=“eachTariff in tariffs” :ref="‘tab’+eachTariff.value">
              {{eachTariff.description}}
              </div>

              this markup creates tabs with correct labels = eachTariff.label but this tabs are not switchable

              1 Reply Last reply Reply Quote 0
              • rstoenescu
                rstoenescu Admin last edited by

                Hi, sorry but don’t have time at the moment to investigate your case. Tabs are going to suffer a refactoring to make it very easy to manage them and avoid Vue $refs side-effects like yours.

                1 Reply Last reply Reply Quote 0
                • druppy
                  druppy last edited by druppy

                  Hi …

                  We have build a simple navigation slot inside q-layout using a dynamic structure much like yours, like this :

                   <q-tabs slot="navigation" class="gt-sm" default>
                       <q-tab v-for="menuLink in menuLinks" :route="menuLink.path" :icon="menuLink.icon" :exact='menuLink.exact'>
                                  {{menuLink.name}}
                       </q-tab>
                   </q-tabs>
                  

                  And this works nicly, but there are 3 things to notice :

                  • it must be a navigation slot insite q-layout
                  • ours use route not name (don’t know if both works)
                  • carefully consider the use of prop exact

                  Hope this helps

                  1 Reply Last reply Reply Quote 1
                  • J
                    jonafrank last edited by

                    Probably a silly question but how do i access setActiveTab() method available in q-tabs ? I need to problematically set the tab in some scenarios

                    1 Reply Last reply Reply Quote 0
                    • rstoenescu
                      rstoenescu Admin last edited by

                      @jonafrank set a Vue reference through “ref” prop.

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