vben
authored
|
1
2
|
<template>
<Tooltip :title="getTitle" placement="bottom" :mouseEnterDelay="0.5">
|
Vben
authored
|
3
|
<span @click="toggle">
|
vben
authored
|
4
5
6
7
8
9
10
11
12
|
<FullscreenOutlined v-if="!isFullscreen" />
<FullscreenExitOutlined v-else />
</span>
</Tooltip>
</template>
<script lang="ts">
import { defineComponent, computed, unref } from 'vue';
import { Tooltip } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
|
Vben
authored
|
13
14
|
import { useFullscreen } from '@vueuse/core';
|
vben
authored
|
15
16
17
18
19
20
21
|
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue';
export default defineComponent({
name: 'FullScreen',
components: { FullscreenExitOutlined, FullscreenOutlined, Tooltip },
setup() {
const { t } = useI18n();
|
Vben
authored
|
22
|
const { toggle, isFullscreen } = useFullscreen();
|
vben
authored
|
23
24
|
const getTitle = computed(() => {
|
Vben
authored
|
25
|
return unref(isFullscreen)
|
vben
authored
|
26
27
28
29
30
31
|
? t('layout.header.tooltipExitFull')
: t('layout.header.tooltipEntryFull');
});
return {
getTitle,
|
Vben
authored
|
32
33
|
isFullscreen,
toggle,
|
vben
authored
|
34
35
36
37
|
};
},
});
</script>
|