退出全屏 esc 触发监听

This commit is contained in:
joshen
2025-03-10 11:46:02 +08:00
parent 216141dbd3
commit 5381416a05

View File

@@ -388,8 +388,12 @@ export default {
window.addEventListener("fullscreenchange", () => {
this.isFullscreen = this.isFullScreen();
});
window.addEventListener("esc", () => {
this.toggleFullScreen();
window.addEventListener("keydown", (e) => {
console.log("是否监听到");
if(e.keyCode == 27){
console.log("是否监听到 esc");
this.toggleFullScreen();
}
});
},
methods: {