kissyteam / kissy

A Powerful Collection Of Modules
http://docs.kissyui.com
2.7k stars 863 forks source link

kissy页面模板中能绑定方法吗? #746

Open peipeichengbao opened 6 years ago

peipeichengbao commented 6 years ago

写一个页面模板,想绑定click方法,结果函数直接运行,并且没有绑定成功

<div class='coupon' onClick="{{clickFunction}}">
    <span>Select Color and Size</span>
</div>
var clickFunction=function(){
    console.log('binding success')
}
var firstObj={
    width:width+'px',
    height:width+'px',
    backgroundColor:'pink',
    clickFunction:clickFunction
}
var newFirstScreen=new XTemplate(firstScreenTemplate).render(firstObj);
Node.all('#firstScreen').html(newFirstScreen);