Home » vue Check box binding Example

vue Check box binding Example

Today, We want to share with you vue Check box binding Example.In this post we will show you v-checkbox, vue emit, vue js watch, hear for Setting a checkbox as checked with Vue.js we will give you demo and example for implement.In this post, we will learn about Using v-model for Two-Way Binding in Vue.js with an example.

vue Check box binding Example

There are the Following The simple About vue Check box binding Example Full Information With Example and source code.

Read Also:  Laravel 5.6 Data Export to CSV and Excel Example

As I will cover this Post with live Working example to develop Check box binding in Vue js, so the Binding Checkbox using Vue for this example is following below.

Check box binding in Vue js

shops data property in Vue instance

<script>
   var vm= new Vue({
      el: "#liveApp",
      data: {
          shops:["Iphones","Laptop","Mobiles"]
      },
    })
</script>

We have use vue.js v-for to iterate data the array of product

<div id='liveApp'>
        <ul>
           <li v-for="product in shops">
            <input  type="checkbox" :value='product'> {{product}}
           </li>
       </ul>
</div>

If We should to set simple checked property as the default value we can have the following simple source code

Read Also:  Laravel 6 Inner Join Query Example - MySQL

We shall change/update the shops array with objects

var vm= new Vue({
      el: "#liveApp",
      data: {
          shops:[
            {"name":"Iphones","checked":false },
            {"name":"Laptop","checked":true },
            {"name":"Mobiles","checked":false }
          ]
      },  
})

therefor now this product will have true or false data Boolean checked property

Your simple HTML source code should be changed as following below example

 <div id='liveApp'>
        <ul>
           <li v-for="product in shops">
            <input  type="checkbox" :value='product.name' v-model="product.checked"> {{product.name}}
           </li>
       </ul>
 </div>
 

Web Programming Tutorials Example with Demo

Read :

Read Also:  VueJS pass multiple value on function with v-on:click

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about vue Check box binding Example.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  paypal express checkout woocommerce Integration
  2. Read Also:  Laravel Custom Dropdown Server Side Filter in Datatables
  3. Read Also:  Laravel 6 Update Increment column
  4. Read Also:  Check all checkboxes in vuejs
  5. Read Also:  Confirm password validation in Angular 6|7|8|9
  6. Read Also:  CodeIgniter JQuery Ajax Request Example
  7. Read Also:  Simple VueJS DataTables Example
  8. Read Also:  PHP Laravel group concat operation
  9. Read Also:  Laravel 5/6/7 create custom facade
  10. Read Also:  Get selected option text with Vue JS Example

Leave a Comment

Your email address will not be published. Required fields are marked *