ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script lang="ts">
import { defineComponent } from 'vue';
 
import { $t } from '@vben/locales';
 
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue';
import { useFullscreen } from '@vueuse/core';
import { Tooltip } from 'ant-design-vue';
 
import { useTableContext } from '../../hooks/useTableContext';
 
export default defineComponent({
  components: {
    FullscreenExitOutlined,
    FullscreenOutlined,
    Tooltip,
  },
  name: 'FullScreenSetting',
 
  setup() {
    const table = useTableContext();
    const { isFullscreen, toggle } = useFullscreen(table.wrapRef);
 
    return {
      isFullscreen,
      t: $t,
      toggle,
    };
  },
});
</script>
<template>
  <Tooltip placement="top">
    <template #title>
      <span>{{ $t('component.table.settingFullScreen') }}</span>
    </template>
    <FullscreenOutlined v-if="!isFullscreen" @click="toggle" />
    <FullscreenExitOutlined v-else @click="toggle" />
  </Tooltip>
</template>