我正在使用这些包
aldeed:collection2,
aldeed:自动成型,
cfs:标准包,
yogiben:自动生成文件,
cfs:文件系统。
{{#with FS.GetFile "images" pictures}}
<img src="{{this.url}}" alt="" class="card-img-bottom">
{{/with}}
Images = new FS.Collection("images",{
stores: [new FS.Store.FileSystem("images")],
filter:{
allow:{
contentTypes: ['image/*']
}
}
});
Images.allow({
insert: function(userId,fileObj){
return true;
},
update:function(userId,fileObj){
return true;
},
download: function(userId,fileObj){
return true;
}
});
Posts = new Mongo.Collection('posts');
Posts.allow({
insert:function(userId,fileObj){
return true;
},
update:function(userId,fileObj){
return true;
}
});
PostSchema = new SimpleSchema({
title:{
type: String,
autoform:{
label:false,
type:"textarea",
placeholder:"Comparte con la comunidad"
}
},
pictures:{
type:[String],
optional: true,
label: " "
},
'pictures.$':{
autoform:{
type:"fileUpload",
collection: 'images',
selectFileBtnTemplate: 'mySelectFileBtn',
previewTemplate: 'myFilePreview',
uploadProgressTemplate: 'myUploadProgressTemplate'
}
},
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"
}
}
});
Posts.attachSchema(PostSchema);
我有这个错误
排队任务中的异常:错误:无效选择器:tzYd8ocD9xhvCCfk7
如果图片显示不是数组时
非常感谢你的帮助。