gaoluyang
2026-06-24 c0cb161bb52ce0fbdce5c66ec391d107c75e2452
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!-- add by puhui999:vxe table 工具栏二次封装,提供给 vxe 原生列表使用 -->
<script setup lang="ts">
import type { VxeToolbarInstance } from 'vxe-table';
 
import { ref } from 'vue';
 
import { useContentMaximize, useRefresh } from '..\..\..\hooks\src';
import { IconifyIcon } from '..\..\..\..\icons\src';
 
import { VxeButton, VxeTooltip } from 'vxe-pc-ui';
import { VxeToolbar } from 'vxe-table';
 
/** 列表工具栏封装 */
defineOptions({ name: 'TableToolbar' });
 
const props = defineProps<{
  hiddenSearch: boolean;
}>();
 
const emits = defineEmits(['update:hiddenSearch']);
 
const toolbarRef = ref<VxeToolbarInstance>();
const { toggleMaximizeAndTabbarHidden, contentIsMaximize } =
  useContentMaximize();
const { refresh } = useRefresh();
 
/** 隐藏搜索栏 */
function onHiddenSearchBar() {
  emits('update:hiddenSearch', !props.hiddenSearch);
}
 
defineExpose({
  getToolbarRef: () => toolbarRef.value,
});
</script>
 
<template>
  <VxeToolbar ref="toolbarRef" custom>
    <template #toolPrefix>
      <slot></slot>
      <VxeTooltip placement="bottom" content="搜索">
        <template #default>
          <VxeButton class="ml-2 font-normal" circle @click="onHiddenSearchBar">
            <IconifyIcon icon="lucide:search" :size="15" />
          </VxeButton>
        </template>
      </VxeTooltip>
      <VxeTooltip
        placement="bottom"
        :content="contentIsMaximize ? '还原' : '全屏'"
      >
        <template #default>
          <VxeButton class="ml-2 font-medium" circle @click="refresh">
            <IconifyIcon icon="lucide:refresh-cw" :size="15" />
          </VxeButton>
        </template>
      </VxeTooltip>
      <VxeTooltip placement="bottom" content="全屏">
        <template #default>
          <VxeButton
            class="ml-2 font-medium"
            circle
            @click="toggleMaximizeAndTabbarHidden"
          >
            <IconifyIcon
              :icon="contentIsMaximize ? 'lucide:minimize' : 'lucide:maximize'"
              :size="15"
            />
          </VxeButton>
        </template>
      </VxeTooltip>
    </template>
  </VxeToolbar>
</template>