ember.js - Ember:无法识别 camelCase 助手引用
问题描述
我将 Ember CLI 从 2.4.6 升级到 2.8.0。在此之后,模板中由 camelCase 名称引用的助手会抛出错误Assertion Failed: A helper named "helperName" could not be found
。如果我将引用更改为helper-name
from helperName
,则一切正常。
解决方案
在最近的 ember 版本中,如果您的助手中有一个破折号(helpers/helper-name.js)
,那么在您的模板中使用花括号将其调用为{{helper-name}}
. 在您的情况下,您的助手是,dasherized
但您正在使用camelCase
.
余烬中2.4
:参考
Unlike components, helpers do not require a dash (-) character in their name.
余烬中2.8
:参考
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.
推荐阅读
- javascript - 使用javascript将单词替换为另一个单词
- angular - Heroku 上的 Angular 7
- java - 我有一个 POST 请求代码,由于某种原因无法正常工作
- jpa - 没有注释的 JPA ORM 映射是否可行?
- javascript - 在 d3 中用本地数据替换 json 时的范围问题
- testing - VS CODE - 使用测试资源管理器 UI,我如何手动排除/包含测试文件
- tensorflow2.0 - Tensorflow 扩展中的训练器组件错误
- python - 在同一个仪表板应用程序上使用外部 css 表和仪表板引导主题
- node.js - 如何让代码在每个周末执行?
- flutter - 如何通过在地图上点击来设置标记?