@nutui/nutui-react-taro
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
84 lines (83 loc) • 2.19 kB
TypeScript
import { default as React, RefObject } from 'react';
import { PopupProps } from '../popup/popup.taro';
import { PickerOption } from './types';
import { BasicComponent } from '../../utils/typings';
export type PickerActions = {
open: () => void;
close: () => void;
};
export interface PickerProps extends Omit<BasicComponent, 'children'> {
/**
* 是否可见
* @default false
*/
visible?: boolean | undefined
/**
* 设置标题
* @default -
*/
title?: string
/**
* 列表数据
* @default []
*/
options: (PickerOption | PickerOption[])[]
/**
* 选中值,受控
* @default []
*/
value?: (number | string)[]
/**
* 默认选中
* @default []
*/
defaultValue?: (number | string)[]
/**
* 是否开启3D效果
* @default true
*/
threeDimensional?: boolean
/**
* 快速滑动时惯性滚动的时长,单位 ms
* @default 1000
*/
duration: number | string
/**
* 是否点击遮罩关闭
* @default true
*/
closeOnOverlayClick: boolean
/**
* 透传popup属性
* @default -
*/
popupProps: Partial<Omit<PopupProps, 'title' | 'onClose' | 'closeOnOverlayClick'>>
/**
* 点击确认按钮时候回调
* @default -
*/
onConfirm?: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void
/**
* 点击取消按钮时触发
* @default -
*/
onCancel?: () => void
/**
* 确定和取消时,都触发
* @default -
*/
onClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void
/**
* 联动时,关闭时回调
* @default -
*/
afterClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], pickerRef: RefObject<HTMLDivElement>) => void
/**
* 每一列值变更时调用
* @default -
*/
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void
children?: any;
}
declare const Picker: React.ForwardRefExoticComponent<Partial<PickerProps> & React.RefAttributes<unknown>>;
export default Picker;