我是流星的新手,刚刚在1.3版本之后到达.由于省略了导入或导出,我一直在努力调试一些非常"愚蠢"的东西,因为大多数教程似乎都没有包含它.因此,以下问题可能属于同一类型.
我想使用autoform包,所以我刚刚添加了包.(之前也包含了simple-schema和collection2).
我收到错误,模板没有加载.
这是我的模板
<template name="addItem">
{{> quickForm collection="Items" id="addItemForm" type="insert" }}
</template>Run Code Online (Sandbox Code Playgroud)
我有我的addItem.js
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Mongo } from 'meteor/mongo';
import { Items } from '/imports/collections/itemCollection.js';
import './addItem.html';
Template.addItem.onCreated(function bodyOnCreated(){
AutoForm.debug();
Meteor.subscribe('items');
});
Template.addItem.helpers({
Items() {
return Items.find({});
},
});Run Code Online (Sandbox Code Playgroud)
还有我的itemCollection.js文件
import { Mongo } from 'meteor/mongo';
export const Items = new Mongo.Collection('items');
Items.allow({
insert: () => false,
update: () => false,
remove: () => false
});
Items.deny({ …Run Code Online (Sandbox Code Playgroud)