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 v-for checkbox list

    Help
    2
    3
    4511
    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.
    • S
      Sujan Dev last edited by Sujan Dev

      Hi,
      I need to loop through an array of values in a form to create a checkbox list and submit the selected checkbox value. my code is below :

      <tr v-for="(item,index) in MenuList">
      <label>{{item.menu_name}}
      <q-checkbox v-model=“vchecklist[index]” ></q-checkbox>
      </label>
      </tr>

      this is not working . i select one checkbox but selected another one .

      my form design is attached as image :

      0_1497786237761_form.png

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

        menuList should be { menu_name: 'blabla label', model: false }

        <tr v-for="(item,index) in MenuList">
           <label>
              {{item.menu_name}}
              <q-checkbox v-model=“item.model”></q-checkbox>
          </label>
        </tr>
        

        This is one option. There are others too. Just don’t bind v-model to a numeric index in an array. Use object instead.

        S 1 Reply Last reply Reply Quote 0
        • S
          Sujan Dev @rstoenescu last edited by

          @rstoenescu thanks a lot :).

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