[英]meteor.js Template helpers as variable vs key+value
Template.hello.loggedin = function() { return something }
與
Template.hello.helpers({
'loggedin': function () { return something }
})
前者工作(Template.hello.loggedin在控制台中打印出函數,添加括號返回的東西),后者沒有(給出undefined)。
我以為這些都是等價的?
除非您找到,否則它們是等效的。 github上存在一個未解決的問題: https : //github.com/meteor/meteor/issues/886 。
如果要調用Template.hello.loggedin()
使用前者。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.