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 implement q-checkbox like Vue?

    Help
    1
    3
    1204
    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.
    • ssuess
      ssuess last edited by

      This works fine for me:

      <li v-for="friend, index in flist">{{ friend.nickname }} <input type="checkbox" :id="friend.id" :value="friend.id" v-model="flistShare"></li>
      

      flistShare is an empty array defined in my data btw. But I can’t get the same to work using q-checkbox. Every item in the loop gets checked or I get errors complaining about expecting a boolean, etc.

      How can this work with q-checkbox? I just want to submit a form where the checkbox values are the ids from my loop.

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

        This does NOT work btw (but shouldn’t it?):

        <li v-for="friend, index in flist">{{ friend.nickname }} <q-checkbox val="friend.id" v-model="flistShare" /></li>
        
        1 Reply Last reply Reply Quote 0
        • ssuess
          ssuess last edited by

          I got it working with 2 modifications. Apparently I couldn’t use my base li element as the v-for, and I needed to set val as a prop:

          <div v-for="friend, index in flist">
          <li>{{ friend.nickname }} <q-checkbox :val="friend.id" v-model="flistShare" /></li>
          </div>
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post