PHP中文网2017-04-10 17:42:59
$(document).on("click", (this._mouseclick = function(e) { }));
// 等价于
this._mouseclick = function(e) { };
$(document).on("click", this._mouseclick);
就是把两句话写成了一句话。
this._mouseclick
现在看来是没有什么用,但是如果需要调用 off()
来去掉某个事件处理函数的时候,就比较有用了,比如
{
bind: function() { },
unbind: function() {
$(document).off("click", this._mouseclick);
}
}
阿神2017-04-10 17:42:59
等价于:
var obj = {
_mouteclick: function(e) {
},
bind: function() {
$(document).on('click', this._mouteclick);
}
}
可能obj._mouteclick
什么时候会拿出来用,但好像又没啥特别意义。