【发布时间】:2017-01-17 02:37:26
【问题描述】:
我在我的流星项目中使用 autoform,并且在我的NewStack 表单中为我的dimensions 字段使用afArrayField。
目前看起来像这样。
这是它的渲染方式:
NewStack.html
<template name="NewStack">
<div class="new-stack-container">
{{#autoForm collection=stacks id="insertStackForm" type="method" meteormethod="createStack" class="new-stack-form"}}
<fieldset>
<legend>Add a Stack!</legend>
{{> afQuickField name='desc'}}
{{> afArrayField name='dimensions'}}
</fieldset>
<button type="submit" class="btn btn-primary">Insert</button>
{{/autoForm}}
</div>
</template>
我希望为每个维度字段看到一个下拉列表,其中填充了我在架构中设置的选项(即dim1、dim2 和dim3)。但是,我似乎无法让表单呈现为纯文本输入以外的任何内容。
Stacks.js
StackSchema = new SimpleSchema({
desc: {
type: String,
label: "Description"
},
dimensions: {
type: [String],
autoform: {
type: "select",
afFieldInput: {
options: [
{label: "dim1", value: 1},
{label: "dim2", value: 2},
{label: "dim3", value: 3}
]
},
}
}
});
有趣的是,如果我在 NewStack.html 中将 afArrayField 更改为 afQuickField,看来 autoform 现在可以看到我的选项(但我显然失去了数组功能)
有什么想法吗? afArrayField 有什么固有的东西使我无法使用某种选择模式吗?
【问题讨论】:
标签: meteor meteor-blaze meteor-autoform