Meteor-是否有任何方法从另一个助手访问助手

Meteor-是否有任何方法从另一个助手访问助手,meteor,Meteor,我找到了。但这不是我想要的 Template.testTemp.helpers({ firstValue: function () { return something }, secondValue: function () { // I want to access firstValue here. // But I dont know what to do. } }) 有人能帮我吗 谢谢 如果在传递的help

我找到了。但这不是我想要的

Template.testTemp.helpers({
    firstValue: function () {
        return something
    },

    secondValue: function () {
        // I want to access firstValue here.
        // But I dont know what to do.
    }
})
有人能帮我吗


谢谢

如果在传递的helper对象之外定义helpers函数,则可以像使用任何其他函数一样使用它们

var firstValue = function () {
  return something;
};

var secondValue = function () {
  var fv = firstValue();
  return somethingelse;
};

Template.testTemp.helpers({
  firstValue: firstValue,
  secondValue: secondValue
});

您可以通过以下方式破解对模板帮助器的调用:

Template.tplName.__helpers.get('helper').call()

MDG建议使用常规函数,然后将其传递给助手、事件等。请参阅。

我发现
secondValue=function(){firstValue=Template.testTemp.firstValue();}
也可以工作!