1、打开html开发工具,新建一个html代码页面

3、使用layer.open创建弹出框。新建一个script标签,然后在这个标签里面使用 layer.open() 创建一个弹出框。创建代码: layer.open({ content: "<div>点击确认按钮回调事件</div>", })

5、设置回调事件。在 layer.open() 里面添加 yes:function(index,layero){} 回调函数,然后在回调函数里面添加一个alert弹出和一个关闭弹出框的功能。代码: yes:function(index,layero){ alert("点击确认按钮触发事件") layer.close(index); //关闭弹出框 }
