【发布时间】:2015-07-15 11:29:28
【问题描述】:
我每次上传都会实例化一个SlingShot uploader 来处理多个文件上传。
更具体一点:
- 我使用
Blaze.renderWithData(Template.uploadItem, file, targetNode);在我的_.each循环中为每次上传渲染一个模板。请参阅下面的循环:
'change .fileBrowse':function(event, template){
_.each(event.currentTarget.files, function(file){
//...
我在之前填写在
_.each循环中的本地集合中跟踪每个上传状态(进度除外)的状态..我在我的
Template.uploadItem.created函数中实例化SlingShot uploader,方法是将它附加到我的模板实例对象(即this.uploader = new Slingshot.Upload( ...)-
我使用
Template.instance().uploader到达它,如此progress帮助代码所示progress: function () { return Math.round(Template.instance().uploader.progress() * 100); }
问题:上传者回调仅在最后一个文件发布后调用一次。其他一切正常,但我无法更新我的 UI,因为我的本地集合中的状态没有更新,因为它应该在执行回调时更新。
【问题讨论】: