我在到處定義模板助手,簡單地測試文檔屬性的平等與恆定的,所以我可以做這樣的事情在我的模板:流星:在Blaze中測試兩個值的相等性的最佳方式是什麼(例如{{#if someVar =='someVal'}})?
{{#if fruitIsPineapple}}...{{/if}}
而且在我的模板助手的樣子:
Template.example.helpers({
fruitIsPineapple: function() { return this.document.fruit === 'pineapple'; }
});
我該如何從創建所有這些幫助者中拯救自己?如果我們在Blaze擁有一個平等運營商,那就太好了......
定義了很多方便的助手,其中包括一個用來測試平等包:https://github.com/raix/Meteor-handlebar-helpers –
爲什麼有人對此表示讚賞嗎?我有同樣的問題,答案沒有記錄在任何地方。 – foobarbecue