以后页面点击返回后,返回到下级页面
在下级页面再次点击返回有效
window.onload = () => {history.pushState("tmp", null, null);
window.onpopstate = () => {history.pushState('new', null, null);
};
}
检测用户触发浏览器返回
window.onpopstate =(event) => {console.log(event.state);
alert("你点击了返回,老哥");
};