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

    formatting generated q-tabs - also getting a explict keys warning

    Framework
    2
    3
    1351
    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.
    • D
      dgk last edited by

      Having trouble getting this to format. In the examples all the q-tab’s are created (manually) together, then all the q-tab-panes. In this way the the tabs appear in a row above the panes.

      I thought erroneously that the “slot” would put them all together regardless of their created order but that’s not true.
      Further even if I comment out the q-tab-pane’s (see below) the tabs still appear in a column so it’s something to do with generated vs manually coded too.

      How can I to fix this without doing a separate v-for the the tabs and panes? Using flex order maybe?

      <q-tabs color="secondary" v-if="ready"  inverted two-lines  v-for="type in Object.keys(schema)">
          <q-tab :name="type"  :label="type"  slot="title" />
           <q-tab-pane :name="type">
             <q-list>
               <div class="row no-wrap" v-for="(item, index) in items[type]">
                 <q-formc  class="col-12" :item="item" :schema="schema[type]" @changed="saved=false" :saved="saved" @save="saveChanges"></q-formc>
               </div>
             </q-list>
           </q-tab-pane>
      </q-tabs>
      

      even this doesn’t work

      <q-tabs color="secondary" v-if="ready"  inverted >
        <div v-for="type in Object.keys(schema)">
          <q-tab :name="type"  :label="type"  slot="title" />
           <!-- <q-tab-pane :name="type">
             <q-list>
               <div class="" v-for="(item, index) in items[type]">
                 <q-formc  class="" :item="item" :schema="schema[type]" @changed="saved=false" :saved="saved" @save="saveChanges"></q-formc>
               </div>
             </q-list>
           </q-tab-pane> -->
      
         </div>
      </q-tabs>
      

      looks like this.

      0_1506556389913_upload-84f55884-e25d-4682-96f0-9092d943fb99

      further I am getting this warning, but if I wrap inside q-tabs with an extra div with the v-for no error (see above). This extra div seems unnecessary, the code functions even with the warning.

      (Emitted value instead of an instance of Error) <q-tabs v-for="type in Object.keys(schema)">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
      
      1 Reply Last reply Reply Quote 0
      • D
        dgk last edited by dgk

        I have figured out the warning. One need only add a `:key=“type” property binding to q-tabs since type is a unique value in my case

        @rstoenescu I’m still unable to to the the q-tabs to render in a row. Is this an issue with the component(s) (to be filed at github) or an issue with my usage.

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

          What you are essentially doing is creating multiple QTabs. Right way to go is:

          <q-tabs color="secondary" v-if="ready"  inverted two-lines>
              <q-tab v-for="type in Object.keys(schema)" :name="type" :key="type"  :label="type"  slot="title" />
               <q-tab-pane v-for="type in Object.keys(schema)" :name="type" :key="`pane-${type}`">
                 <q-list>
                   <div class="row no-wrap" v-for="(item, index) in items[type]">
                     <q-formc  class="col-12" :item="item" :schema="schema[type]" @changed="saved=false" :saved="saved" @save="saveChanges"></q-formc>
                   </div>
                 </q-list>
               </q-tab-pane>
          </q-tabs>
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post