尝试将input
组件与组件助手一起使用,如下所示:
passedComponent=(component 'input' type="number" value=myValue)
将导致断言失败,如下所示:
Uncaught Error: Assertion Failed: You cannot use 'input' as a component name. Component names must contain a hyphen
@stevesims这是正确的。 当前无法使用input
创建闭包组件。 理由在某种程度上与 Glimmer 组件有关,我们想为这些保留名称input
。
暂时关闭它,因为它不是错误,但我们可以重新打开并继续讨论。
因此,这意味着input
组件需要重命名 - 这显然是不切实际的 - 或者应该提供标准的连字符包装器
无法将标准(内置)组件与组件助手一起使用似乎是一个相当奇怪和任意的限制
{{#if requiresComponentSubstitution}}
<!-- requiresComponentSubstitution: is not "input" -->
{{component inputComponentName
id=(concat elementId '-control')
class='form-control'
type=type
name=valuePath
placeholder=placeholder
value=value
input=(action 'onInput')
}}
{{else}}
{{input id=(concat elementId '-control')
class='form-control'
type=type
name=valuePath
placeholder=placeholder
value=value
input=(action 'onInput')
}}
{{/if}}
我将其作为一种有用的解决方法提供,并巧妙地暗示这是使用 Ember 的一个缺点。 如果它“有效”那就太棒了:)
最有用的评论
因此,这意味着
input
组件需要重命名 - 这显然是不切实际的 - 或者应该提供标准的连字符包装器无法将标准(内置)组件与组件助手一起使用似乎是一个相当奇怪和任意的限制