最好用全屏写法,点击按钮,f11可全屏,点击退出全屏,f11,esc可退出
技能vue3 + ts
经常有同学觉得说 点击按钮全屏或者 f11没退出,或者手动f11 esc不好用,这次给个全的拉
直接上代码
<template>
<span
@click="handleFullScreen"
class="full-screen"
:class="{
'quit-screen': isFullScreen,
}"
>{
{
isFullScreen ? "退出全屏" : "全屏" }}</span
>
</template>
<script lang="ts" setup>
import {
reactive,
defineEmits,
defineProps,
ref,
onMounted,
onUnmounted,
} from "vue";
const isFullScreen