diff --git a/src/layouts/components/Header/components/Fullscreen.vue b/src/layouts/components/Header/components/Fullscreen.vue index 493e5226..61b5f382 100644 --- a/src/layouts/components/Header/components/Fullscreen.vue +++ b/src/layouts/components/Header/components/Fullscreen.vue @@ -12,14 +12,19 @@ import screenfull from "screenfull"; const isFullscreen = ref(screenfull.isFullscreen); onMounted(() => { - screenfull.on("change", () => { - if (screenfull.isFullscreen) isFullscreen.value = true; - else isFullscreen.value = false; - }); + if (screenfull.isEnabled) { + screenfull.on("change", () => { + if (screenfull.isFullscreen) isFullscreen.value = true; + else isFullscreen.value = false; + }); + } }); const handleFullScreen = () => { - if (!screenfull.isEnabled) ElMessage.warning("当前您的浏览器不支持全屏 ❌"); - screenfull.toggle(); + if (screenfull.isEnabled) { + screenfull.toggle(); + } else { + ElMessage.warning("当前您的浏览器不支持全屏 ❌"); + } };