【发布时间】:2016-06-18 07:08:13
【问题描述】:
我有一个全局变量来存储用户上传图片的 url。 在将其添加到数据库之前,如何将该变量作为属性添加到文档中?
这是我的代码
Meteor.methods({
submitPost: function (app) {
// Console.log('new App:', app);
check(app, {
title: String,
description: String,
category: String,
price: Number
});
Products.insert(app);
}
});
我想在“app”中添加全局变量,然后再将其插入 Products 集合
我该怎么做?
这是我在收藏中添加的内容
previewImage: {
type: String,
autoValue: function(){
return PIurl;
},
autoform: {
type: "hidden"
}
},
createdAt:{
type: String,
autoValue: function(){
return new Date();
},
autoform: {
type: "hidden"
}
}
}));
添加上述代码后,点击提交时没有任何反应,表单不再存储在数据库中
【问题讨论】: