[]list的selectHandler属性连续点击同一个item不能重复接收事件
使用的是引擎示例中的代码:https://layaair.ldc.layabox.com/demo/?category=2d&group=UI&name=List
list.selectEnable = true;
list.selectHandler = new Handler(this, onSelect);
function onSelect(index)
{
alert("当前选择的索引:" + index);
}
第一次点击时有事件响应:
再次点击(不要点击其它的列表),就不会有响应事件:
希望能解决这个问题,是有这个需求的,比如list在A界面,选中后跳到B界面,返回后,再次点击同一行就无法再次进入,尤其是当list还只有1行时,就无法再次看到B界面。
list.selectEnable = true;
list.selectHandler = new Handler(this, onSelect);
function onSelect(index)
{
alert("当前选择的索引:" + index);
}
第一次点击时有事件响应:
再次点击(不要点击其它的列表),就不会有响应事件:
希望能解决这个问题,是有这个需求的,比如list在A界面,选中后跳到B界面,返回后,再次点击同一行就无法再次进入,尤其是当list还只有1行时,就无法再次看到B界面。
没有找到相关结果
已邀请:
要回复问题请先登录
5 个回复
w1114367261
赞同来自:
selectHandler只有你改变选择项的时候才执行一次哦!
Giealxon
赞同来自:
han123peng
赞同来自:
dz5566
赞同来自:
laya.ui.js改成这样即可,去掉判断if (this._selectedIndex !=value)
__getset(0,__proto,'selectedIndex',function(){
return this._selectedIndex;
},function(value){
//if (this._selectedIndex !=value){
this._selectedIndex=value;
this.changeSelectStatus();
this.event(/*laya.events.Event.CHANGE*/"change");
this.selectHandler && this.selectHandler.runWith(value);
this.startIndex=this._startIndex;
//}
});
达尔文
赞同来自: