【发布时间】:2016-01-28 02:35:32
【问题描述】:
{{my-component can-delete=true canDelete=true}}
在my-component 模板中,我想从attrs 对象访问can-delete。
{{attrs.can-delete}} <!-- does not work, prints blank, should print true -->
{{attrs.canDelete}} <!-- works, prints true-->
我尝试使用 get 助手
{{get attrs 'can-delete'}}
但得到一个错误Uncaught Error: Assertion Failed: The first argument to {{get}} must be a stream
如何从 HTMLBar 中访问非通常格式的对象属性?
【问题讨论】:
-
你不需要使用“attrs”。去{{can-delete}}