Blame view

src/layouts/default/tabs/components/TabRedo.vue 898 Bytes
vben authored
1
<template>
Vben authored
2
3
4
  <span :class="`${prefixCls}__extra-redo`" @click="handleRedo">
    <RedoOutlined :spin="loading" />
  </span>
vben authored
5
6
7
8
9
10
11
12
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import { RedoOutlined } from '@ant-design/icons-vue';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useTabs } from '/@/hooks/web/useTabs';

  export default defineComponent({
Vben authored
13
    name: 'TabRedo',
Vben authored
14
    components: { RedoOutlined },
vben authored
15
16
17

    setup() {
      const loading = ref(false);
Vben authored
18
vben authored
19
20
21
22
23
24
25
26
27
      const { prefixCls } = useDesign('multiple-tabs-content');
      const { refreshPage } = useTabs();

      async function handleRedo() {
        loading.value = true;
        await refreshPage();
        setTimeout(() => {
          loading.value = false;
          // Animation execution time
Vben authored
28
        }, 1200);
vben authored
29
      }
Vben authored
30
      return { prefixCls, handleRedo, loading };
vben authored
31
32
33
    },
  });
</script>