我试着做一个简单的画廊。对于上传文件,我使用cfs:autoform包。那是收藏
@Gallery = new Mongo.Collection("gallery")
Gallery.attachSchema(new SimpleSchema(
name:
type: String
fileIds:
type: [String]
)
)
@Images = new FS.Collection("images",
stores: [new FS.Store.FileSystem("images", path:"~/uploads")]
)
那是观点
<template name="insertForm">
{{#autoForm id="insertForm" type="insert" collection="Gallery"}}
{{> afQuickField name="name"}}
{{> afQuickField name="fileIds" type="cfs-files" collection="images"}}
<button type="submit">Submit</button>
{{/autoForm}}
</template>
但是按下按钮后会抛出错误
Exception in setTimeout callback: TypeError: Cannot read property 'split' of undefined
at Object.Util.deepFind (http://localhost:3000/packages/cfs_autoform.js?ca0ee21422d608dd4c429aa4c230839a532b1cd9:289:16)
at cb (http://localhost:3000/packages/cfs_autoform.js?ca0ee21422d608dd4c429aa4c230839a532b1cd9:168:28)
at http://localhost:3000/packages/cfs_autoform.js?ca0ee21422d608dd4c429aa4c230839a532b1cd9:220:13
at http://localhost:3000/packages/raix_eventemitter.js?2698ca3a2e678f77962ebe839ad04615958a4c26:122:16
at Array.forEach (native)
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:11)
at _runCallbacks (http://localhost:3000/packages/raix_eventemitter.js?2698ca3a2e678f77962ebe839ad04615958a4c26:118:7)
at EventEmitter.emit (http://localhost:3000/packages/raix_eventemitter.js?2698ca3a2e678f77962ebe839ad04615958a4c26:150:12)
at oneChunkQueueEnded [as onEnded] (http://localhost:3000/packages/cfs_upload-http.js?cf37b2941c8cdbfd85cdc3948f57fed4bb429081:510:19)
at PowerQueue.next (http://localhost:3000/packages/cfs_power-queue.js?255f444fbb9de891f6e803923430c0dc1fa40e4f:478:14)