我想做一些类似于这个问题的事情:Meteor:带有对象数组的自定义自动窗体
也就是说,我想在数组的每个元素中手动布局每个字段。
不同的是,我仍然希望使用afArrayField
及其默认模板,包括添加和删除数组项的按钮。我只想把我自己的布局传递给afArrayField
。我该怎么做?
如果我没有说清楚,请要求澄清,我会重新措辞。
您可能需要创建一个自定义模板(doc:https://github.com/aldeed/meteor-autoform#creating-a定制模板)。
你可以做类似的事情(未测试):
<template name="your_template">
{{# autoForm [...]}}
[...]
{{> afQuickField name="players" template="custom_players"}}
[...]
{{/autoForm}}
</template>
<template name="afArrayField_custom_players">
your custom template for players field
</template>
你也可以看看默认的afArrayField模板来激励自己:
- 普通:https://github.com/aldeed/meteor-autoform/blob/devel/templates/plain/components/afArrayField/afArrayField.html
- 引导程序3:https://github.com/aldeed/meteor-autoform/blob/devel/templates/bootstrap3/components/afArrayField/afArrayField.html