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
| <script setup lang="ts">
| import type { ScrollAreaRootProps } from 'radix-vue';
|
| import { computed } from 'vue';
|
| import { cn } from '@vben-core/shared/utils';
|
| import {
| ScrollAreaCorner,
| ScrollAreaRoot,
| ScrollAreaViewport,
| } from 'radix-vue';
|
| import ScrollBar from './ScrollBar.vue';
|
| const props = withDefaults(
| defineProps<
| ScrollAreaRootProps & {
| class?: any;
| onScroll?: (event: Event) => void;
| viewportProps?: { onScroll: (event: Event) => void };
| }
| >(),
| {
| onScroll: () => {},
| },
| );
|
| const delegatedProps = computed(() => {
| const { class: _, ...delegated } = props;
| return delegated;
| });
| </script>
|
| <template>
| <ScrollAreaRoot
| v-bind="delegatedProps"
| :class="cn('relative overflow-hidden', props.class)"
| >
| <ScrollAreaViewport
| as-child
| class="h-full w-full rounded-[inherit] focus:outline-none"
| @scroll="onScroll"
| >
| <slot></slot>
| </ScrollAreaViewport>
| <ScrollBar />
| <ScrollAreaCorner />
| </ScrollAreaRoot>
| </template>
|
|