聚合物数据绑定:大括号与方括号
Polymer Data Bindings: Curly vs Square brackets
通读 Polymer 3.0
文档,我注意到同时使用了大括号 {{}}
和方括号 [[]]
。如果有的话,这两种数据绑定方法有什么区别?
documentation 状态:
Whether data flow goes down from host to target, up from target to
host, or both ways is controlled by the type of binding annotation and
the configuration of the target property.
- Double-curly brackets ({{ }}) support both upward and downward data flow.
- Double square brackets ([[ ]]) are one-way, and support only downward data flow.
通读 Polymer 3.0
文档,我注意到同时使用了大括号 {{}}
和方括号 [[]]
。如果有的话,这两种数据绑定方法有什么区别?
documentation 状态:
Whether data flow goes down from host to target, up from target to host, or both ways is controlled by the type of binding annotation and the configuration of the target property.
- Double-curly brackets ({{ }}) support both upward and downward data flow.
- Double square brackets ([[ ]]) are one-way, and support only downward data flow.