// 点击关闭浏览器时触发关闭事件 window.addEventListener("beforeunload",e=>{ console.log("执行关闭时事件"); // 这里写要执行的事件 }); 记录工作中遇到的每个小问题!