我有一个字符串数组作为参数传递给组件,在组件内部我使用“每个”帮助器来呈现文本输入中的每个字符串。我尝试了以下方法。
MainComponent.hbs
<Component @model={{model}}/>
//Eg: model.list = ["Jack", "Sparrow"];
Component.hbs
<div>
{{#each this.args.model.list as |name|}}
<div>
<PaperInput @value={{ name }}
@placeholder="Enter a Name"
@onChange={{action (mut name)}}/>
</div>
{{/each}}
</div>
我遇到了错误“未捕获(承诺)错误:断言失败:您只能将路径传递给 mut”。如果有人能让我知道这里出了什么问题,我将不胜感激。