uni-ui-plus
Version:
uni-ui-plus 一个现代化的 uni-app 组件库
80 lines (72 loc) • 1.55 kB
text/typescript
import type { ExtractPropTypes, PropType } from 'vue'
export interface WaterfallItem {
id?: string | number
index?: number
[key: string]: any
}
export interface ColumnHeight {
column: number
height: number
}
export interface FlowData {
column: number
columnSpace: number
list: WaterfallItem[]
[key: string]: any
}
export const waterfallProps = {
/**
* @description 瀑布流数据列表
*/
list: {
type: Array as PropType<WaterfallItem[]>,
default: () => []
},
/**
* @description 列数
* @default 2
*/
column: {
type: Number,
default: 2
},
/**
* @description 列间距(百分比)
* @default 2
*/
columnSpace: {
type: Number,
default: 2
},
/**
* @description 图片字段名
* @default 'imgUrl'
*/
imageField: {
type: String,
default: 'imgUrl'
},
/**
* @description 获取图片源的方法
* @default undefined
*/
getImageSrc: {
type: Function as PropType<(item: WaterfallItem) => string>,
default: undefined
},
/**
* @description 是否根据图片信息排序
* @default false
*/
sortByImgInfo: {
type: Boolean,
default: false
}
}
export type WaterfallProps = ExtractPropTypes<typeof waterfallProps>
export interface WaterfallEmits {
(e: 'load-complete'): void
(e: 'item-click', item: WaterfallItem, index: number): void
(e: 'image-error' | 'image-load', item: WaterfallItem): void
}
export const waterfallEmits = ['load-complete', 'item-click', 'image-load', 'image-error'] as const