kri*_*oph 2 html javascript meteor meteor-blaze meteor-autoform
我无法让应用程序在Meteor上运行.quickform没有链接我的Collection.
"模板助手中的异常:错误:配方不在窗口范围内"
有人可以帮到这里吗?
这是我的quickform代码
<template name="NewRecipe">
<div class="new-recipe-container">
{{> quickForm collection="Recipes" id="insertRecipeForm" type="insert" class="new-recipe-form" }}
</div>
</template>Run Code Online (Sandbox Code Playgroud)
这是我的集合架构
Recipes = new Mongo.Collection('recipes');
RecipeSchema = new SimpleSchema({
name: {
type: String,
label:"Name"
},
desc: {
type: String,
label:"Description"
},
author: {
type: String,
label:"Author",
autoValue: function() {
return this.userId
}
},
createdAt: {
type: Date,
label:"Created At",
autoValue: function() {
return new Date()
}
}
});
Recipes.attachSchema( RecipeSchema );Run Code Online (Sandbox Code Playgroud)
我无法对你的问题发表评论,因为我的声誉不到50,所以我将其作为答案发布.
我正在遵循相同的中间流星Level Up Tuts,但是通过尝试遵循新的Application结构和导入语法,因为我正在使用Meter 1.3并且我想要遵循最新的最佳实践.
我有这个错误,因为当我试图写
{{> quickForm collection="Recipes" id="insertRecipeForm" type="insert" class="new-recipe-form" }}
Run Code Online (Sandbox Code Playgroud)
即
collection ="食谱"(带引号)
这是一个问题,因为在Meteor 1.3中,由于es2015模块,Meteor 1.3中没有"全局"的东西了.我没有像你那样定义Collection(和Level Up Tuts中的Scott一样),我用const声明定义了Collection 并用ec2015模块语法导出它(参见我提供的github问题).点我的收藏品不在全球范围内.所以我必须编写一个模板助手来返回集合并编写quickForm模板包含如下:
collection =食谱(不含报价单)
现在,食谱是一个模板助手,它返回食谱集合对象
Template.NewRecipe.helpers({
Recipes(){
return Recipes;
}
});
Run Code Online (Sandbox Code Playgroud)
我从这里开始了解这个问题
但是既然你正在使用Meteor的旧应用程序结构方法(我猜?)Meteor仍在支持,那么我现在可能只能想到一个问题,即最新版本的autoform是专为Meteor 1.3而设计的. .我搜索了Meteor论坛,我收到了一篇同样关注的帖子.
你可以尝试两件事:
也许让我知道每个人的发现?