如何在Ember 3.8中调用嵌套余烬组件

时间:2019-07-19 13:29:25

标签: javascript ember.js frameworks

我正在尝试使用基于新角度的语法调用在名为expandable-items的父组件中定义的名为icon-plus-button的组件 旧的方式就像

{{#expandable-items/icon-plus-button
    expandedText=
    text=(t 'sideBarNav.dashboard')
    expanded=expanded linkTo='dashboard'
    toggleExpanded={{action "toggleExpanded"}}
}}
    {{fa-icon "line-chart"}}
{{/expandable-items/icon-plus-button}}

新方法就像

<ExpandableItemsIconPlusButton
  @expanded={{this.expanded}}
  @expandedImage={{fa-icon "angle-double-left"}}
  @expandedText={{t "sideBarNav.collapseMenu"}}
  @toggleExpanded={{action "toggleExpanded"}}
/>

我收到此错误消息

opcode-compiler.js:140 Uncaught Error: Compile Error: Cannot find component expandable-items-icon-plus-button
    at opcode-compiler.js:140
    at Compilers.compile (opcode-compiler.js:42)
    at compile (opcode-compiler.js:718)
    at LazyCompiler.add (opcode-compiler.js:912)
    at CompilableBlock.compile (opcode-compiler.js:707)
    at Object.evaluate (runtime.js:717)
    at AppendOpcodes.evaluate (runtime.js:69)
    at LowLevelVM.evaluateSyscall (runtime.js:3270)
    at LowLevelVM.evaluateInner (runtime.js:3216)
    at LowLevelVM.evaluateOuter (runtime.js:3208)

1 个答案:

答案 0 :(得分:3)

开箱即用Ember 3.8不能执行此操作。使用https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill或升级到Ember 3.10

语法是:

<ExpandableItems::IconPlusButton ...