You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

26 lines
860 B

<script lang="ts" setup>
import { computed, unref } from 'vue'
import { Tooltip } from 'ant-design-vue'
import { useFullscreen } from '@vueuse/core'
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue'
import { useI18n } from '@/hooks/web/useI18n'
defineOptions({ name: 'FullScreen' })
const { t } = useI18n()
const { toggle, isFullscreen } = useFullscreen()
// 重新检查全屏状态
isFullscreen.value = !!document.fullscreenElement
const getTitle = computed(() => {
return unref(isFullscreen) ? t('layout.header.tooltipExitFull') : t('layout.header.tooltipEntryFull')
})
</script>
<template>
<Tooltip :title="getTitle" placement="bottom" :mouse-enter-delay="0.5">
<span @click="toggle">
<FullscreenOutlined v-if="!isFullscreen" />
<FullscreenExitOutlined v-else />
</span>
</Tooltip>
</template>