在mousedown中存储变量的问题 - Sencha ExtJs

时间:2015-10-07 18:33:44

标签: javascript extjs mousedown

我遇到了在组件类中传递所需变量的问题。问题是当点击旋转时,再次调用该类并将current_cursor_position设置回' undefined'。我还没有找到另一种注册鼠标的方法。它似乎在共享变量之间存在真正的问题。任何建议书?

提前致谢,

代码段:

    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
}

…

1 个答案:

答案 0 :(得分:0)

我正在使用.mon错误

this.getView()。mon(this.getView()。getEl(),' mousedown',myFunction,this)