Files
element-plus/packages/carousel/src/carousel.ts
BeADre 59422d7fab fix(carousel): fix carousel don't update the indicator and items when data change(#1244)
* fix(carousel): add methods of remove item

* fix: if delete item is current item then go next

Co-authored-by: Ryan2128 <33176053+Ryan2128@users.noreply.github.com>
2021-01-24 18:19:04 +08:00

50 lines
1.1 KiB
TypeScript

import { Ref, ToRefs, UnwrapRef } from 'vue'
export interface ICarouselItemProps {
name: string
label: string | number
key: string
}
export interface ICarouselItemData {
hover: boolean
translate: number
scale: number
active: boolean
ready: boolean
inStage: boolean
animating: boolean
}
export interface ICarouselProps {
initialIndex: number
height: string
trigger: string
autoplay: boolean
interval: number
indicatorPosition: string
indicator: boolean
arrow: string
type: string
loop: boolean
direction: string
}
export type UnionCarouselItemData = ICarouselItemProps & ToRefs<ICarouselItemData>
export interface CarouselItem extends UnionCarouselItemData {
uid: number
translateItem: (index: number, activeIndex: number, oldIndex: number) => void
}
export interface InjectCarouselScope {
direction: string
offsetWidth: Ref<number>
offsetHeight: Ref<number>
type: string
items: Ref<UnwrapRef<CarouselItem[]>>
loop: boolean
addItem: (item: CarouselItem) => void
removeItem: (uid: number) => void
setActiveItem: (index: number) => void
}