mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix(switch):set disabled for loading status & set cursor as not-allowed (#13219)
This commit is contained in:
parent
2bf0fadb11
commit
171e36680f
@ -42,7 +42,8 @@ exports[`renders ./components/switch/demo/loading.md correctly 1`] = `
|
||||
<div>
|
||||
<button
|
||||
aria-checked="true"
|
||||
class="ant-switch-loading ant-switch ant-switch-checked"
|
||||
class="ant-switch-loading ant-switch ant-switch-checked ant-switch-disabled"
|
||||
disabled=""
|
||||
role="switch"
|
||||
type="button"
|
||||
>
|
||||
@ -70,7 +71,8 @@ exports[`renders ./components/switch/demo/loading.md correctly 1`] = `
|
||||
<br />
|
||||
<button
|
||||
aria-checked="false"
|
||||
class="ant-switch-small ant-switch-loading ant-switch"
|
||||
class="ant-switch-small ant-switch-loading ant-switch ant-switch-disabled"
|
||||
disabled=""
|
||||
role="switch"
|
||||
type="button"
|
||||
>
|
||||
|
@ -48,7 +48,7 @@ export default class Switch extends React.Component<SwitchProps, {}> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { prefixCls, size, loading, className = '' } = this.props;
|
||||
const { prefixCls, size, loading, className = '', disabled } = this.props;
|
||||
const classes = classNames(className, {
|
||||
[`${prefixCls}-small`]: size === 'small',
|
||||
[`${prefixCls}-loading`]: loading,
|
||||
@ -64,6 +64,7 @@ export default class Switch extends React.Component<SwitchProps, {}> {
|
||||
<RcSwitch
|
||||
{...omit(this.props, ['loading'])}
|
||||
className={classes}
|
||||
disabled={disabled || loading}
|
||||
ref={this.saveSwitch}
|
||||
loadingIcon={loadingIcon}
|
||||
/>
|
||||
|
@ -153,8 +153,11 @@
|
||||
|
||||
&-loading,
|
||||
&-disabled {
|
||||
pointer-events: none;
|
||||
cursor: not-allowed;
|
||||
opacity: @switch-disabled-opacity;
|
||||
* {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user