Meteor Blaze mixins没有注册

时间:2015-09-01 06:38:17

标签: meteor meteor-blaze

我在包中创建了一些自定义Blaze组件,并且已经将一些共享功能提炼到了mixin中。但是,由于某些原因我的mixin无法识别,我看到这样的错误:

Exception from Tracker recompute function:
debug.js:41 Error: Must be attached
    at DOMRange.firstNode (domrange.js:191)
    at Template.constructView.view.templateInstance (template.js:168)
    at templateInstanceToComponent (lib.coffee:12)
    at lib.coffee:104
    at Object.Tracker.nonreactive (tracker.js:560)
    at Object.Blaze._getTemplateHelper (lib.coffee:103)
    at Blaze.View.lookup (lookup.js:104)
    at template.nav.js?4fba4334a27ad5d54a92350b0b1bb6bbd979ceb3:21
    at null.<anonymous> (builtins.js:49)
    at view.js:191

这就是我所拥有的:

mixins.js

var InputMixin = BlazeComponent.extendComponent({
  foo: function() {
    // A helper
  }
});

input.js

var InputComponent = BlazeComponent.extendComponent({
  mixins: function() {
    return [InputMixin];
  }
}).register('InputComponent');

在我的packages.js

Package.onUse(function(api) {
  api.addFiles([
    'lib/client/mixins.js',
    'lib/client/input.js',
  );
});

不确定如何处理此问题。任何见解都表示赞赏。

0 个答案:

没有答案