2016-07-30 68 views
0
Recipes= new Mongo.Collection('recipes'); 

Ingredient = new SimpleSchema({ 
    name: { 
     type: String 
    }, 
    amount: { 
     type: String 
    } 
}); 

RecipeSchema = new SimpleSchema({ 
    name: { 
     type: String, 
     label: "Name" 
    }, 
    desc: { 
     type: String, 
     label: "Description" 
    }, 
    ingredients: { 
     type: [Ingredient] 
    }, 
    inMenu: { 
     type: Boolean, 
     defaultValue: false, 
     optional: true, 
     autoform: { 
      type: "hidden" 
     } 
    }, 
    author: { 
     type: String, 
     label: "Author", 
     autoValue: function(){ 
      return this.userId 
     }, 
     autoform:{ 
      type:"hidden" 
     } 
    }, 
    createdAt: { 
     type: Date, 
     label: "Created At", 
     autoValue: function(){ 
      return new Date() 
     }, 
     autoform: { 
      type:"hidden" 
     } 
    } 
}) 

如何將此表單自定義爲兩欄。兩列應該有輸入類型以及如何使用引導?如何在流星中自定義快速表單

回答

0

您可以將類字段添加到每一列,如:

author: { 
     type: String, 
     label: "Author", 
     autoValue: function(){ 
      return this.userId 
     }, 
     autoform:{ 
      type:"hidden" 
     }, 
     class: 'class-name-here' 
    }