【问题标题】:How do I use {{#autoForm}} for each individual element of [Object] array?如何为 [Object] 数组的每个单独元素使用 {{#autoForm}}?
【发布时间】:2015-09-12 08:48:33
【问题描述】:

我想做一些与这个问题非常相似的事情:Meteor: Custom AutoForm with array of objects

也就是说,我想在数组的每个元素中手动布局每个字段。

不同的是,我仍然想使用afArrayField 及其默认模板,包括添加和删除数组项的按钮。我只想将自己的布局传递给afArrayField。我该怎么做?

如果我没有说清楚,请要求澄清,我会改写。

【问题讨论】:

    标签: meteor meteor-autoform


    【解决方案1】:

    您可能需要创建一个自定义模板(文档:https://github.com/aldeed/meteor-autoform#creating-a-custom-template)。

    你可以做类似的事情(未经测试):

    <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 模板来激发自己的灵感:

    【讨论】:

      猜你喜欢
      • 2017-07-18
      • 1970-01-01
      • 2020-06-17
      • 2016-10-25
      • 1970-01-01
      • 2022-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多