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

    [SOLVED] q-route-tab with q-tab-panel content as seperate components

    Framework
    2
    6
    3398
    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.
    • G
      genyded last edited by genyded

      Anyone have or know of example where a-tabs are on one page and have q-route-tabs with q-tab panel content coming from other components? If we have everything on the same page, it works, but if the panel content is other components via the router, we get:

      Error in render: "TypeError: Cannot read property 'name' of undefined"
      
      found in
      
      ---> <QTabPanels>
             <QCard>
               <QPage>
                 <PageAuth> at src/pages/Auth.vue
                   <QPageContainer>
                     <QLayout>
                       <MyLayout> at src/layouts/MyLayout.vue
                         <App> at src/App.vue
                           <Root>
      
      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        That usually means your tab component isn’t getting the data it needs or rather the data it needs is undefined. Without code to see what you are attempting, it’s hard to say what is wrong. Try putting in some example code here: https://codesandbox.quasar.dev

        Scott

        1 Reply Last reply Reply Quote 0
        • G
          genyded last edited by genyded

          OK. tried this - https://codesandbox.io/s/codesandbox-app-m507d - but as usual these sandboxes are a pain in the a** and cannot see my single file components.

          1 Reply Last reply Reply Quote 0
          • G
            genyded last edited by genyded

            OK - I took the components out of the router and added them back and now they are working. The Quasar docs do not have a literal example of this (route-tab since the slot prop ), so I am probably missing something simple. Not sure what or how to pass it since these is no slot prop anymore. Is the 'name; now the ‘value’?

            1 Reply Last reply Reply Quote 0
            • G
              genyded last edited by

              Anyone have any thoughts on this? https://codesandbox.io/s/codesandbox-app-m507d still getting the original error.

              G 1 Reply Last reply Reply Quote 0
              • G
                genyded @genyded last edited by

                OK after quite a bit of trial and error, finally figured this out and it’s way different than prior 1.x quasar versions. You used to have one <router-view> for all tabs, now you need one for each tab (at least if using panels). I’ve posted an actual full working version at https://codesandbox.io/s/codesandbox-app-endd4 in case any else runs into it or needs a reference. The code looks a bit odd with the multiple (3 in this case) <router-view> elements, but it works:

                <template>
                  <q-page class="flex flex-center">
                    <q-card>
                      <q-tabs inverted color="secondary" narrow-indicator class="bg-grey-3" dense>
                        <q-route-tab default name="login" :to="'/login'" label="Login"/>
                        <q-route-tab name="forgot" :to="'/forgot'" label="Forgot Password"/>
                        <q-route-tab name="register" :to="'/register'" label="Register"/>
                      </q-tabs>
                      <q-tab-panels v-model="tab" animated>
                        <q-tab-panel name="login">
                          <router-view/>
                        </q-tab-panel>
                        <q-tab-panel name="forgot">
                          <router-view/>
                        </q-tab-panel>
                        <q-tab-panel name="register">
                          <router-view/>
                        </q-tab-panel>
                      </q-tab-panels>
                    </q-card>
                  </q-page>
                </template>
                
                <style>
                </style>
                
                <script>
                export default {
                  name: 'PageIndex',
                  data() {
                    return {
                      tab: 'login'
                    }
                  }
                }
                </script>
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post