0

guys, I want to know a thing is possible or not as described below supposed have I have 3 thing illustration of frontend

     <td><input  type="checkbox" v-model="named[0]></td>
     <td><input  type="checkbox" v-model="named[1]></td>
     <td><input  type="checkbox" v-model="named[2]></td>

   fruit list    | checkbox
   ----------------------------
    apple        | checkbox        -> if this clicked passed true else pass false 
    mango        | checkbox        -> if this clicked passed true else pass false 
      orange     | checkbox        -> if this clicked passed true else pass false 

suppose user clicked apple and orange checkbox and clicked on submit then v-model named should have array value like this 0:true 1:false 3:true is this possible in vue

1 Answer 1

2

hello rocky you can try something like this

  <input v-model="smoking" true-value="1" false-value="0" type="checkbox">

if checkbox is checked then you get 1 else 0 in same array

Sign up to request clarification or add additional context in comments.

1 Comment

you code is working only if i click on checkbox else i m getting empty for that array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.