antd-mini
Version:
antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。
66 lines (58 loc) • 1.09 kB
text/typescript
import { IBaseProps } from '../_util/base';
/**
* @description 开关。
*/
export interface ISwitchProps extends IBaseProps {
/**
* @description 是否勾选
*/
checked?: boolean;
/**
* @description 是否加载状态
*/
loading?: boolean;
/**
* @description 选中时的颜色
*/
color?: string;
/**
* @description 选中时的内容
*/
checkedText?: string;
/**
* @description 非选中时的内容
*/
uncheckedText?: string;
/**
* @default medium
* @description 尺寸
*/
size?: 'medium' | 'small' | 'x-small';
/**
* 是否禁用
*/
disabled?: boolean;
/**
* 是否只读
*/
readonly?: boolean;
/**
* 初始值
*/
defaultChecked?: boolean;
/**
* @description 修改回调方法
*/
onChange?: (checked: boolean, e: Record<string, any>) => void;
}
export const SwitchDefaultProps: Partial<ISwitchProps> = {
checked: null,
loading: false,
color: '',
checkedText: '',
uncheckedText: '',
size: 'medium',
disabled: false,
readonly: false,
defaultChecked: false,
};