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

    How to change a tab from a q-tab-panel

    Help
    3
    6
    1594
    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.
    • L
      lawrence615 last edited by

      I have q-tabs and q-tab-panels, multiple q-tab and q-tab-panel within each respectively. I am looking for a way to switch to a different tab from a q-tab-panel. I have tried to emit different events (@slide, @change, @input) but none is been received in the parent view which hosts the structure. Below is my implementation;

      1. tabs
            <q-tabs
              v-model="page"
              no-caps
              active-color="white"
              active-bg-color="indigo"
              indicator-color="transparent"
              class="bg-transparent text-indigo shadow-2">
              <q-tab :ripple="false" name="page-1" label="1"/>
              <q-tab :ripple="false" name="page-2" label="2"/>
              <q-tab :ripple="false" name="page-3" label="3"/>
            </q-tabs>
      
      1. tab panels
          <q-tab-panels v-model="page"
                        animated
                        class="full-width bg-transparent"
                        @slide="moveTo"
                        @change="moveTo"
                        @input="moveTo">
            <q-tab-panel name="page-1">
              <page1></page1>
            </q-tab-panel>
            <q-tab-panel name="page-2">
              <page2></page2>
            </q-tab-panel>
            <q-tab-panel name="page-3">
              <page3></page3>
            </q-tab-panel>
          </q-tab-panels>
      
      1. model
      ...
      
      data() {
            return {
              page: 'page-1'
            }
          },
      ...
      

      I have tried to fire an event from a q-tab-panel so that I can mutate the page model to a different tab but not working;

              this.$emit('slide', 'slide')
              this.$emit('change', 'change')
              this.$emit('input', 'input')
      

      Kindly assist.

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

        @lawrence615 see the examples https://quasar.dev/vue-components/tab-panels#Example--With-QTabs . otherwise make a reproduction codepen.

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

          Are you trying to manipulate the tab selection outside of the tabs?

          Scott

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

            @s-molinari Yes, that’s exactly what am trying to achieve. Select a different tab by an event and not clicking or touch

            1 Reply Last reply Reply Quote 0
            • L
              lawrence615 @metalsadman last edited by

              @metalsadman I have gone through this and there’s no solution to my problem. What am trying to achieve is, moving to a tab without touching or clicking to it. Something like taking a user to the first tab after going through all tabs automatically

              metalsadman 1 Reply Last reply Reply Quote 0
              • metalsadman
                metalsadman @lawrence615 last edited by

                @lawrence615 check the api docs methods section, there are methods there to navigate your tabs programmatically.

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