基本上这是我的代码,它被重复了。have_last_attr
如果我使用2 次(如果在内部),它不起作用。我怎么能管理它?
# .html
{{#if have_last_attr}}
<h3>Last attribute was {{last_attr}}</h3>
{{/if}}
# .js
Template.game.have_last_attr = function(){
var game_id = Session.get('current_game'),
game = Games.findOne(game_id),
attr = game['last_attr'];
return TRANSLATE[attr];
};
Template.game.last_attr = function(){
var game_id = Session.get('current_game'),
game = Games.findOne(game_id),
attr = game['last_attr'];
return TRANSLATE[attr];
};
提前致谢