【发布时间】:2017-06-07 06:05:42
【问题描述】:
我正在做 LevelUpTuts 的“中级 Meteor 教程 #8 - 插入权限、发布和流星玩具”,我的问题是我无法提交我检查了 5 次代码的表单,但我认为一切都是正确的,我正在运行流星 1.4这是我的代码
我的 Recipes.js 文件
Recipes = new Meteor.Collection('recipes');
Recipes.allow({
insert: function(userId, doc) {
return !!userId;
}
});
RecipeSchema = new SimpleSchema ({
name: {
type: String,
label: "Name"
},
desc: {
type: String,
label: "Description"
},
author: {
type: String,
label: "Author",
autoValue: function() {
return this.userID
},
autoform: {
type: "hidden"
},
},
createdAt: {
type: Date,
label: "CreatedAt",
autoValue: function() {
return new Date()
},
autoform: {
type: "hidden"
},
},
});
Recipes.attachSchema( RecipeSchema);
我的食谱.js
Meteor.subscribe('recipes');
我的新食谱.js
<template name="NewRecipe">
<div class="new-recipe-container">
{{> quickForm collection="Recipes" id="insertRecipeForm" type="insert" class="new-recipe-form"}}
</div>
</template>
还有 publis.js 文件
Meteor.publish('recipes', function(){
return Recipes.find({author: this.userId});
});
请帮帮我,我不知道我做错了什么
【问题讨论】:
标签: javascript html meteor meteor-blaze meteor-autoform