在组件类中传递一个需要的变量时,我遇到了一个问题。问题是,当单击启动时,类被再次调用,并且current_cursor_position被设置回“未定义”。我还没有找到另一种注册鼠标按下的方法。在共享变量之间似乎有一个真正的问题。有什么建议吗?
提前谢谢你,
代码片段:
current_cursor_position: undefined, //global variable to hold the cursor position that is used when spinUp is click. Also is used to store mouse down position
init{
this.getView().addListener('spinup', this.spinnerUp, this);
this.getView().addListener('spindown', this.spinnerDown, this);
this.getView().mon(this.getView().getEl(), {
mousedown: function(e) {
this.current_cursor_position = //logic to find and store user current mouse click
}
},
spinnerUp {
this.current_cursor_position = //recorded cursor position
…
//logic to increment time
}
…
发布于 2015-10-10 04:25:04
我用错了.mon
this.getView().mon(this.getView().getEl(),'mousedown',myFunction,this)
https://stackoverflow.com/questions/32999895
复制相似问题