Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 bindAttr 更改属性值时是否可以使用 registerBoundHelper? HTML
<div class="bar" {{styleWidth bindAttr style="value"}}></div>
JS
Ember.Handlebars.registerBoundHelper('styleWidth', function(width){ return ("width: " + width + "px;"); });
非常感谢
制作一个观察样式的绑定助手很难实现。
有一个Ember.StyleBindingsMixinin emberella可以为您处理这个问题。
Ember.StyleBindingsMixin
我希望它有帮助