-
Notifications
You must be signed in to change notification settings - Fork 0
Jquery 重复监听
ythy edited this page Sep 1, 2017
·
1 revision
setPagerListenerAndPlugins(pagerData:LBSearchStoreListResultInfo):void{
$(document).on('click', '#lastPage', null, ():void=>{
this.onSearch(pagerData.startIndex - this.mPageSize);
});
}
上述方法setPagerListenerAndPlugins
执行多次后, 每次Click
都会触发监听及onSearch
多次.
正确做法是先清除监听:
setPagerListenerAndPlugins(pagerData:LBSearchStoreListResultInfo):void{
$(document).off('click', '#lastPage');
$(document).on('click', '#lastPage', null, ():void=>{
this.onSearch(pagerData.startIndex - this.mPageSize);
});
}
tell me how get back to sunshine