-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
/
VCarouselItem.tsx
47 lines (38 loc) 路 1.11 KB
/
VCarouselItem.tsx
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
// Components
import { makeVImgProps, VImg } from '@/components/VImg/VImg'
import { makeVWindowItemProps, VWindowItem } from '@/components/VWindow/VWindowItem'
// Utilities
import { genericComponent, propsFactory, useRender } from '@/util'
// Types
import type { VImgSlots } from '@/components/VImg/VImg'
export const makeVCarouselItemProps = propsFactory({
...makeVImgProps(),
...makeVWindowItemProps(),
}, 'VCarouselItem')
export const VCarouselItem = genericComponent<VImgSlots>()({
name: 'VCarouselItem',
inheritAttrs: false,
props: makeVCarouselItemProps(),
setup (props, { slots, attrs }) {
useRender(() => {
const imgProps = VImg.filterProps(props)
const windowItemProps = VWindowItem.filterProps(props)
return (
<VWindowItem
class={[
'v-carousel-item',
props.class,
]}
{ ...windowItemProps }
>
<VImg
{ ...attrs }
{ ...imgProps }
v-slots={ slots }
/>
</VWindowItem>
)
})
},
})
export type VCarouselItem = InstanceType<typeof VCarouselItem>