Ember: 无法识别驼峰式帮助程序引用

Ember: camelCase helper references not recognised

我将 Ember CLI 从 2.4.6 升级到 2.8.0。在此之后,模板中以驼峰命名法引用的帮助程序将抛出错误 Assertion Failed: A helper named "helperName" could not be found。如果我将引用从 helperName 更改为 helper-name,一切正常。

在最近的 ember 版本中,如果您的助手中有破折号 (helpers/helper-name.js),则在您的模板中使用大括号将其命名为 {{helper-name}}。在你的例子中,你的助手是 dasherized 但你是用 camelCase 调用它的。

在ember 2.4中:Reference

Unlike components, helpers do not require a dash (-) character in their name.

在ember2.8中:Reference

Unlike components, which require a dash in the name to follow the Custom Element spec, helper names can be single or multi-word. If your helper's name is multi-word, it should be dasherized in your template.