我有quickform一旦提交按钮点击,这种方法被触发如何将默认值设置为类型[String]的集合中的元素?
submitPost: function (app) {
check(app, {
title: String,
description: String,
category: String,
price: Number
});
var knownId = Products.insert(app);
Products.update({ _id: knownId }, { $set:{screenShots: scs, previewImage: pi, sourceCode: zip }});
}
提交按钮不工作时,我并没有给“截屏,previewImage和源代码”集合中默认值。
一旦我给他们的默认值就像如下所示
previewImage: {
type: String,
defaultValue: "jjj",
},
sourceCode: {
type: String,
defaultValue: "jjj",
},
screenShots: {
type: [String],
autoValue: function() {
return [];
}
},
现在的形式提交按钮是否工作正常,更新方法被触发。它会同时更新“previewImage和sourcCode”,但“screenShots”仍然是空的。
我不确定,但我相信问题与autoValue,我应该使它成为一个默认值,但我如何给一个元素类型的字符串数组的默认值?
或者问题与其他事情有关?
我可以知道您用于模式设计的包吗? –
@PankajJatav aldeed/meteor-collection2包如果我明白你的问题对 –