layer弹出层关闭后刷新父页面
可以写到jQuery的加载后事件中${}
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
//判断是否是有弹窗
if(index) {
//关闭layer弹框
parent.layer.close(index);
//进行跳转(注意:此处必须加parent.location,否者获取不到父窗体)
parent.location.href = '/index';
}
当然了,你也可以加个定时器,延时1秒再跳转,显着委婉些o(* ̄︶ ̄*)o

本文介绍了一种在使用layer弹出层组件时,如何在关闭弹窗后刷新父页面的方法。通过获取窗口索引并利用parent.location.href属性进行页面跳转,实现了平滑的用户体验。
1万+

被折叠的 条评论
为什么被折叠?



