chore: 将全屏按钮置于顶部,使其显眼且易于操作 (#969)

* chore: 将全屏按钮置于顶部,使其显眼且易于操作
This commit is contained in:
xiaoming
2024-03-12 14:36:45 +08:00
committed by GitHub
parent 593fc1bb26
commit d1f0a3fd36
10 changed files with 90 additions and 50 deletions

View File

@@ -0,0 +1,30 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useNav } from "@/layout/hooks/useNav";
const screenIcon = ref();
const { toggle, isFullscreen, Fullscreen, ExitFullscreen } = useNav();
isFullscreen.value = !!(
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement
);
watch(
isFullscreen,
full => {
screenIcon.value = full ? ExitFullscreen : Fullscreen;
},
{
immediate: true
}
);
</script>
<template>
<span class="fullscreen-icon navbar-bg-hover" @click="toggle">
<IconifyIconOffline :icon="screenIcon" />
</span>
</template>