我曾经知道这意味着什么,但我现在正在努力...
这基本上是说document.onload吗?
(function () {
})();
Run Code Online (Sandbox Code Playgroud) 我有一个data.json文件,我想加载,我已经放在lib /文件夹中.为了将JSON加载到服务器中的变量,我该怎么办?谢谢
我有
var Schemas = {};
Meteor.isClient && Template.registerHelper("Schemas", Schemas);
Schemas.Person = new SimpleSchema({
fullName: {
type: String,
index: 1,
optional: true,
},
email: {
type: String,
optional: true
},
address: {
type: String,
optional: true
},
isActive: {
type: Boolean,
},
age: {
type: Number,
optional: true
}
});
Run Code Online (Sandbox Code Playgroud)
在一个文件和
var Collections = {};
Meteor.isClient && Template.registerHelper("Collections", Collections);
Persons = Collections.Persons = new Mongo.Collection("Persons");
Persons.attachSchema(Schemas.Person);
Run Code Online (Sandbox Code Playgroud)
在另一个文件中.
我收到了错误ReferenceError: Schemas is not defined.很明显,我必须Schemas在我的collections.js文件中定义而不是将它们分开.但Meteor如何在单独的文件中使用代码?我可以访问一些对象和变量,而其他对象和变量是无法访问的.