layerui弹出层按钮回调,参考官网
layer.open({
content: 'test'
,btn: ['按钮一', '按钮二', '按钮三']
,yes: function(index, layero){
//按钮【按钮一】的回调
}
,btn2: function(index, layero){
//按钮【按钮二】的回调
//return false 开启该代码可禁止点击该按钮关闭
}
,btn3: function(index, layero){
//按钮【按钮三】的回调
//return false 开启该代码可禁止点击该按钮关闭
}
,cancel: function(){
//右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭
}
});
回调函数里index,layero参数分别是什么?
layer.open({
title: '在线调试'
,content: '配置各种参数,试试效果',
yes:function(index,layero){
console.log(index);
console.log(layero);
return false;
}
});
在文档页面在线调试输入上面代码运行,再点击确定,可以看到,index是指弹出框的索引,layero是指弹出框的信息的对象