我已经使用Simple-Schema包创建了一个Schema,例如:
// Schema definition of this content type
Conditional_Schema = new SimpleSchema({
item_type: {
type: String,
label: 'Type',
allowedValues: ['Product', 'File', 'Comment']
},
product_name: {
label: 'Product',
type: String,
autoform: {
group: '02_Product'
// this field should be available and shown
// in form only when
// this.field("item_type").value === "Product"
}
},
product_price: {
label: 'Price',
type: String,
autoform: {
group: '02_Product'
// this field should be available and shown
// in form only when
// this.field("item_type").value === "Product"
}
}
});
我如何为架构指定条件,以便Product Details
的上述字段仅在选择值Product
时显示在表单中,而没有模板助手(afFieldValueContains
)。