使用simpl-schema
时出现以下错误:
SimpleSchema is not a constructor
我已经添加了
aldeed:autoform
aldeed:collection2@3.0.0
"simpl-schema": "^1.4.3"
我的代码:
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
export const Books = new Mongo.Collection("books");
const Book = new SimpleSchema({
title: {
type: String,
label: "Title",
max: 200
},
author: {
type: String,
label: "Author"
},
copies: {
type: SimpleSchema.Integer,
label: "Number of copies",
min: 0
},
lastCheckedOut: {
type: Date,
label: "Last date this book was checked out",
optional: true
},
summary: {
type: String,
label: "Brief summary",
optional: true,
max: 1000,
optional: true
}
});
Books.attachSchema(Book);
是什么原因造成的,我该如何解决?