mercredi 20 mai 2020

How can i get state of a checkbox whether is checked or no not in vuejs

<input class="checkout-item" :value="cart_food.id" @change="sumOfProduct(cart_food.quantity,cart_food.variation.price)" name="cart_item[]"  v-model="checkbox" type="checkbox">

sumOfProduct(price,quantity) {
        this.productPrice = price;
        this.productQuantity = quantity;
        var total = (this.productPrice * this.productQuantity);
            this.totalPrice.push(total);
            this.totalPrice.pop(total);

            var sum = this.totalPrice.reduce(function(a, b)
            {
                return a + b;
            }, 0);

        console.log(sum);
        this.finalPrice = sum;
    },

In my sumOfProduct method i want to verify the checkbox whether it is checked or not. Any idea how can i achive this.




Aucun commentaire:

Enregistrer un commentaire