javascript - 延迟回调异常: Error: No such template: wiki

标签 javascript meteor

我创建了一个名为 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/

相关文章:

javascript - 如何使用 postMessage 集中 YouTube iframe 的控件

javascript - nivo slider 只能工作一次

javascript - 返回数组中带有父元素的单个子元素

javascript - react - 当 onClick 子项时创建一个事件类

mongodb - Meteor.js - 对多个集合进行用户搜索的方法

jquery - 有没有更好的方法来使用 Meteor.js 根据输入字段响应式更新 html?

javascript - 获取 javascript 动态创建的控件状态

java - 当我将水平滚动条移至最左侧时,垂直滚动条不可见

html - 在 Meteor 元素 : bug or feature? 中使用 ES6 `import` 和 CSS/HTML 文件

jquery - Meteor 和 jQuery : . css 不起作用,.addClass ("css-class") 有效