【发布时间】:2016-08-26 00:58:47
【问题描述】:
万事如意,
我正在尝试用另一个组件包装一个组件以提供简化的编辑包装器。
该组件将有条件地显示标签或选择组件,以允许用户选择正确的值。
我想包装 power-select 组件,并将其值传递给子组件,因此页面模板组件引用如下所示:
{{cm-select
title="Country ##"
options=countries
selected=selectedCountry
searchField="name"
action="selectCountry"
}}
"countries" 是一个国家对象数组,并且 selectedCountry 是这些国家对象之一。
组件模板有以下内容:
<td>{{title}}</td>
<td>
{{#if edit}}
{{#power-select
options=options
selected=selected
searchField=searchField
as |object|}}
{{object.name}}
{{/power-select}}
{{else}}
<small>{{modelElement}}</small>
{{/if}}
</td>
不幸的是,power-select 组件呈现一个空的选项列表。
我认为将这些参数包装在把手中可能会奏效,但把手中的把手似乎不是有效的语法。
有人有什么想法吗?
谢谢,
安迪
【问题讨论】:
标签: ember.js components