【发布时间】:2023-03-19 08:55:01
【问题描述】:
使用meteor-uploads 包的内置引导模板,上传完成时有一个方便的方法来进行模板特定的回调
<template name="home">
{{> upload_bootstrap callbacks=myCallbacks }}
</template>`
和
Template.home.helpers({
myCallbacks: function() {
return {
finished: function(index, fileInfo, context) { ... },
...
}
}
})
但对于我来说,在定义自定义模板described here 时,我无法弄清楚如何做同样的事情:
<template name="customUpload">
<form method="POST" enctype="multipart/form-data">
<input type="file" class="jqUploadclass" data-form-data='{{ submitData }}'>
{{#with infoLabel}}
{{ infoLabel}} <button class="start">StartUpload</button>
<div style="width: 200px; height: 30px; border: 1px solid black">
<div style="background: red; height: 30px; width: {{ progress }}">
{{ progress }}
</div>
</div>
{{/with}}
</form>
</template>
上传完成后,谁能帮我了解如何从自定义模板运行 myCallbacks 函数?
(例如,根据调用上传者的模板将 fileInfo 添加到不同的集合中)
【问题讨论】:
标签: templates meteor upload callback