我正在尝试使用锤子:锤子2.0.4_2包与Meteor 1.0.1并且我收到以下错误:
Tracker afterFlush函数的异常:undefined不是a function TypeError:undefined不是函数
由于Helper Block,我认为错误与DOM尚未渲染有关。到目前为止,我无法在任何地方找到答案。其他人是否有相同的错误或知道如何解决这个问题?
的客户机/ profile.js
Template.myTemplate.rendered = function() {
this.$('body').hammer({ <-- Line of the Error in Console..
drag_min_distance:1,
swipe_velocity:0.1
})
}
Template.myTemplate.events({
'press #mcPress': function() {
console.log('yay!')
}
})
client / profile.html
{{#with thisUser}}
// some html stuff
<div id="mcPress">Some content</div>
{{/with}}
答案 0 :(得分:1)
Hammer.js作为一个独立的(这是官方软件包的提供方式)不附带jQuery plugin,因此如果不手动添加,则无法使用该语法你自己的jQuery插件。
很容易做你自己的那个包的本地分支并插上插件(我还没有发布它,因为我对Atmosphere命名空间乱问题非常敏感)。或者,您可以在页面加载时包含插件。无论哪种方式,该语法应该工作,或者,如果失败,您只需使用core docs中描述的非jQuery语法。