我正在开发基于表单的应用程序。我创建了自定义组件来处理表单显示。
我所拥有的一个用例是显示一个对象列表及其属性如下:
{{#r-tabs}}
{{#each buildings as |b index|}}
{{#r-tabs-panel}}
{{#r-form-fieldset}}
{{r-form-control label="egid" property="buildings:0/EGID" value=b.EGID size='md'}}
{{r-form-control label="bezeichnung" property="buildings:0/description" content=buildingDescriptions size="lg"}}
{{#r-form-group label="strasse / nr."}}
{{r-form-control label="strasse" property="buildings:0/streetName" value=b.address.streetName size="lg"}}
{{r-form-control label="nr." property="buildings:0/streetNum" value=b.address.streetNum}}
{{/r-form-group}}
{{r-form-control label="Baujahr" property="buildings:0/yearOfConstruction" value=b.yearOfConstruction}}
{{r-form-control label="Kubatur" property="buildings:0/cubature" value=b.cubature size="md" unit="m³"}}
{{r-form-control label="Neuwert" property="buildings:0/value" value=b.value size="md"}}
{{/r-form-fieldset}}
{{/r-tabs-panel}}
{{/each}}
{{/r-tabs}}
我想使用index
循环中的{{#each}}
,以便通过替换硬编码0
来使属性动态化。但到目前为止我没有成功。