我正在查看其所需格式的文档。但我想知道如何添加选项的ID。
groupedNumbers: [
{ groupName: 'Smalls', options: ['one', 'two', 'three'] },
{ groupName: 'Mediums', options: ['four', 'five', 'six'] },
{ groupName: 'Bigs', options: [
{ groupName: 'Fairly big', options: ['seven', 'eight', 'nine'] },
{ groupName: 'Really big', options: [ 'ten', 'eleven', 'twelve' ] },
'thirteen'
]
},
'one hundred',
'one thousand'
]
以下是我要做的事情
groupedNumbers: [
{ groupName: 'Smalls', options: [{
id: 1,
name: 'one'
},
{
id: 2,
name: 'two'
}]
]
这是我调用组件的地方
<label for="menu-group-list">Service Category</label>
{{#power-select
options=groupedCategories
searchEnabled=true
selected=selectedSubCategoryName
selectedItemComponent="selected-service"
onchange=(action "serviceSubCategoryChanged")
as |category| }}
{{category}}
{{/power-select}}
我以为我可以覆盖optionsComponent
,但这不起作用。想法?
答案 0 :(得分:0)
options=groupedCategories
您需要提供options=groupedNumbers
{{category}}
,您需要说{{category.name}}