我创建了一个名为 Wiki 的 Meteor 包。
在包内我有一个wiki.html,其中包含
<template name="wiki">
FULL WIKI UI CODE HERE
</template>
然后我有一个wiki.js,我在其中声明了我的集合和事件。但是,在我的 wiki.js 中,我收到一条错误消息
Uncaught TypeError: Cannot read property 'helpers' of undefined
Exception in defer callback: Error: No such template: wiki
我不明白,因为我已经有了 wiki 模板。在我的 package.js 中,我有这个:
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
api.use('ecmascript');
api.use('templating', 'client');
api.use('easy:search', 'client');
api.use('templates:tabs', 'client');
api.use('blaze-html-templates', 'client');
api.addFiles('wiki.js', 'client');
api.addFiles('wiki.html', 'client');
api.addFiles('wikiserver.js', 'server');
});
我是否遗漏了一些为什么无法检测到模板 wiki 的内容?但是,如果我删除 JS 文件中的所有代码,一切都会正常。请帮忙。
最佳答案
在 wiki.js 之前添加 wiki.html
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
api.use('ecmascript');
api.use('templating', 'client');
api.use('easy:search', 'client');
api.use('templates:tabs', 'client');
api.use('blaze-html-templates', 'client');
api.addFiles('wiki.html', 'client');
api.addFiles('wiki.js', 'client');
api.addFiles('wikiserver.js', 'server');
});
关于javascript - 延迟回调异常: Error: No such template: wiki,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34129333/