8
如何值传递给模板事件如何将参数传递给流星中的模板事件?
的Html
<template name="Header">
<div class="testClass">Text1</div> // pass a = 1
<div class="testClass">Text2</div> // pass a = 2
</template>
的Javascript
Template.Header.events({
'click .testClass':function(event, template){
console.log(a) //print a values
}
});
这并没有为我工作。但是,'template.data.a'没有。 – shmck 2015-08-19 01:54:47
同样在这里 - 'template.data.a'会诀窍! – thomers 2015-09-14 16:20:55
你确定你有完全相同的代码,因为'this.a'肯定会给我返回'1'。 – saimeunt 2015-09-14 16:34:29