我想更新一个在Ember 3.28没有辛烷值的项目到4.4版本。
我尝试使用ember-cli-update
更改版本,现在抛出各种错误,例如必须与@
和花括号组件一起使用的模板属性不再支持…
我是Ember的新手,我不明白是否仍然可以使用4.4的经典语法,如果是这样,我如何继续使用经典语法?尤其是在模板上。
谢谢!
我是Ember的新手
你好!并欢迎! !
仍然可以使用4.4中的经典语法,
在Ember 4.0之后不可能使用一些经典语法。
特别是当你有{{theseThings}}
时,你必须:
- 在范围内定义
theseThings
(如在严格模式下,或通过let
或组分收率)
或{{#let ... as |theseThings|}} {{theseThings}} {{/let}}
<Foo as |theseThings|> {{theseThigs}} </Foo>
- 将调用声明为:
- 参数(前置
@
,即{{@theseThings}}
) - 局部变量的"上下文";(这个/类实例),所以:
{{this.theseThings}}
- 参数(前置
有一个代码模块来帮助处理这些事情,但它有点挑剔,您需要逐个文件:
- https://github.com/ember-codemods/ember-no-implicit-this-codemod
- https://github.com/ember-codemods/ember-angle-brackets-codemod/