1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/open-hand-choerodon-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
index.tsx 1.6 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
HughHzWu Отправлено 3 лет назад acf16fd
import React, { Component, ReactNode } from 'react';
import classNames from 'classnames';
import omit from 'lodash/omit';
import RcSwitch from '../rc-components/switch';
import { Size } from '../_util/enum';
import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext';
export interface SwitchProps {
prefixCls?: string;
size?: Size;
className?: string;
checked?: boolean;
defaultChecked?: boolean;
onChange?: (checked: boolean) => any;
checkedChildren?: ReactNode;
unCheckedChildren?: ReactNode;
disabled?: boolean;
loading?: boolean;
}
export default class Switch extends Component<SwitchProps, {}> {
static get contextType(): typeof ConfigContext {
return ConfigContext;
}
static displayName = 'Switch';
context: ConfigContextValue;
private rcSwitch: any;
focus() {
if (this.rcSwitch) {
this.rcSwitch.focus();
}
}
blur() {
if (this.rcSwitch) {
this.rcSwitch.blur();
}
}
saveSwitch = (node: RcSwitch | null) => {
this.rcSwitch = node;
};
render() {
const { prefixCls: customizePrefixCls, size, loading, className = '' } = this.props;
const { getPrefixCls } = this.context;
const prefixCls = getPrefixCls('switch', customizePrefixCls);
const classes = classNames(className, {
[`${prefixCls}-small`]: size === Size.small,
[`${prefixCls}-loading`]: loading,
});
return (
<RcSwitch
{...omit(this.props, ['loading'])}
prefixCls={prefixCls}
className={classes}
ref={this.saveSwitch}
/>
);
}
}

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/open-hand-choerodon-ui.git
git@gitlife.ru:oschina-mirror/open-hand-choerodon-ui.git
oschina-mirror
open-hand-choerodon-ui
open-hand-choerodon-ui
master