Event Binding

use @EventName attribute binding event handler, Syntax is @EventName="Method"

PAGE Script:

Yao({
buyNow: ( event )=>{
console.log( event );
console.log( this.getData("pet") );
},
addToCart: ( event )=>{}
});

YAOML:

<section class="summary">
<div>
<div class="title">{{ pet.title }}</div>
<div class="price">{{ pet.price }}L[[$]]</div>
<div class="action">
<button class="btn btn-primary" @click="buyNow">L[[Buy]]</button>
<button class="btn btn-primary" @click="addToCart">L[[Add To Cart]]</button>
</div>
</div>
</div>

When the Buy button clicked, executing the buyNow() method.