ukelli-ui
Version:
Base on React's UI lib. Make frontend's dev simpler and faster.
40 lines (39 loc) • 1.03 kB
TypeScript
import { PureComponent } from 'react';
export interface SwitchProps {
/** 值改变的回调 */
onChange?: (val: any) => void;
/** 是否禁用 */
disabled?: boolean;
/** 开关的提示,第一个是激活状态,第二个是消极状态 */
tips?: string[];
/** 组件的输出,第一个是激活状态,第二个是消极状态 */
outputs?: any[];
/** 当前激活的 index */
checked?: number | boolean;
/** defaultChecked */
defaultChecked?: boolean;
}
interface State {
checked: boolean;
}
/**
* 开关
*
* @export
* @class Switch
* @extends {PureComponent}
*/
export default class Switch extends PureComponent<SwitchProps, State> {
static defaultProps: {
tips: string[];
disabled: boolean;
outputs: boolean[];
defaultChecked: boolean;
};
isControl: any;
constructor(props: any);
getValue: () => number | boolean | undefined;
onChange: (nextValue: any) => void;
render(): JSX.Element;
}
export {};