这是我的架构但是没有显示带有字段名称和数量的成分对象,也没有显示我的图像上传文件。所以你能告诉我我的错误以及如何纠正它吗?
Recipes.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Recipe Name",
max: 100
},
ingredients: {
type: Object,
label:"Ingredients",
minCount: 1
},
"ingredients.$.name": {
type: String
},
"ingredients.$.amount": {
type: String
},
description: {
type: String,
label: "How to prepare ",
},
time: {
type: Number,
label: "Time (Minutes)",
},
image: {
type: String,
autoform: {
afFieldInput: {
type: 'fileUpload',
collection: 'RecipesImages',
label: 'Recipe Picture'
}
}
},
createdAt: {
type: Date
}
}));
在这里,我将它们与自动表单一起放入我的模板中
{{#autoForm collection="Recipes" id="insertRecipes" type="insert"}}
<fieldset>
<legend>Add a Recipe</legend>
{{> afQuickField name='name'}}
{{> afQuickField name='Ingredients'}}
{{> afQuickField name='Ingredients.name'}}
{{> afQuickField name='Ingredients.amount'}}
{{> afQuickField name='description' rows=6}}
{{> afQuickField name='time'}}
{{> afQuickField name='image'}}
</fieldset>
<button type="submit" class="btn btn-primary">Add Recipe</button>
{{/autoForm}}