I haven't gone down the road of creating custom components, I have got it checking for the coupon code now I need to know how I can set a the cost then apply the discount.
Heres the JS I have currently
new Vue({
el: '#coupons',
data: function() {
return {
coupon: {
code: '',
description: '',
discount: 0
},
valid: false
};
},
methods: {
validate: function() {
this.$http.get('/coupons/' + this.coupon.code)
.success(function(coupon) {
this.coupon = coupon;
this.valid = true;
this.coupon.description = 'Great! You entered a valid coupon.';
})
.error(function() {
this.coupon.code = '';
this.coupon.description = 'Sorry, that coupon does not exist.';
});
}
}
});
Anyone advise on how to achieve this based on the above please :) Presumably I would need to pass the value from Laravel to the JS, again how would I achieve this, then apply the discount, would I se v-model for example to use two way binding?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire