将 css 类添加到 Ember.Select

Add css class to Ember.Select

本文关键字:Ember Select 添加 css      更新时间:2023-09-26

我需要将css类添加到Ember.Select view:

{{view Ember.Select contentBinding="kpiTypes" valueBinding="model.amount" optionValuePath="content.value" optionLabelPath="content.name"}}

仅添加类不起作用

使用 classNames 属性:

{{view Ember.Select classNames="foo bar"}}

对不起,我知道我真的迟到了。 但这可能会为需要帮助的其他人节省时间。

正如 Marcio 所说,如果您希望将其作为静态类添加到您的标签中,您可以使用 classNames。如果你需要绑定一个动态属性作为它的类,我们可以使用 classNameBindings 关键字。

{{view Ember.Select contentBinding="App.algosController" selectionBinding="App.selectedAlgoController.algo" optionLabelPath="content.algoName" optionValuePath="content.id" classNameBindings="App.selectedAlgoController.algo.algoType"}}