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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Snippet Contents

vue Check box binding Example

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

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

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 :

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.   Toggle Switches Laravel, Ajax and jQuery example
  2.   php calculate date difference in laravel carbon query
  3.   laravel middleware check custom header for REST API
  4.   failed to load resource: the server responded with a status of 404 (not found)
  5.   Angular 6 Event Binding Tutorial From Scratch
  6.   Vue JS Get URL Query String Parameters value Example
  7.   Laravel passing multiple variables Across multiple pages
  8.   vuejs Manipulate Numbers Money Format
  9.   PHP Arrays Example Tutorial For Beginners From Scratch
  10.   How To Configure Supervisor For Laravel 5/6/7 Queue Jobs?

Leave a Reply

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