如上图所示,当用户发布新帖子时,我想要望远镜 nova 中的动态(名称、数量)字段。
下面是我的客户包 custom_field.js
var NameAmount = new Mongo.Collection("NameAmount");
NameAmount .schema = new SimpleSchema({
country:{
type:String
},
RelDate:{
type:Date
}
});
NameAmount.attachSchema(NameAmount .schema);
Posts.addField({
fieldName: "Name_Amount",
fieldSchema: {
type: [NameAmount],
optional: true,
control:NameAmountForm,
insertableIf: canInsert,
editableIf: canEdit,
join: {
joinAs: "Name_Amount",
collection: () => Name_Amount
}
}
});
下面是我的 Meteor React NameAmountForm
render(){
const nameAmt =new Array(2);
return(<div>
{newAmt.map(function(items){
return(<div>
Name <input type="text" name="Name" value="xyz"/>
Amount <input type="text" name="Amount" value="xyz"/>
</div>)
})}
</div>)
}
我没有添加和删除数组..bocz 我不想让它变得复杂