Vue Custom Event Validation
<script>
export default{
mounted(){
console.log(this.$slots.footer);
},
emits:{
"buy-now-clicked": function(data){
if (!data){
return false;
}
I
return true;
},
props:{product:{type: Object, default: () => ({})}},
methods:{
handleBuyNowClick(){
this.$emit("buy-now-clicked", this.product);
},
handleAddToCartClick(){
this.$emit("add-to-cart-clicked", this.product);
}
}
};
</script>
Irfan