簡體   English   中英

meteor.js模板助手作為變量vs鍵+值

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM