2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-11-21 16:10:46 +08:00
|
|
|
title:
|
2016-07-21 09:51:04 +08:00
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-07-13 08:00:31 +08:00
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-11-18 16:56:22 +08:00
|
|
|
基本滑动条。当 `range` 为 `true` 时,渲染为双滑块。当 `disabled` 为 `true` 时,滑块处于不可用状态。
|
2015-07-13 08:00:31 +08:00
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Basic slider. When `range` is `true`, display as dual thumb mode. When `disable` is `true`, the slider will not be interactable.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2016-11-21 16:37:04 +08:00
|
|
|
import { Slider, Switch } from 'antd';
|
|
|
|
|
|
|
|
class Demo extends React.Component {
|
|
|
|
state = {
|
|
|
|
disabled: false,
|
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
handleDisabledChange = disabled => {
|
2016-11-21 16:37:04 +08:00
|
|
|
this.setState({ disabled });
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2016-11-21 16:37:04 +08:00
|
|
|
render() {
|
|
|
|
const { disabled } = this.state;
|
|
|
|
return (
|
2020-07-07 23:04:27 +08:00
|
|
|
<>
|
2016-11-21 16:37:04 +08:00
|
|
|
<Slider defaultValue={30} disabled={disabled} />
|
|
|
|
<Slider range defaultValue={[20, 50]} disabled={disabled} />
|
2016-11-29 13:17:08 +08:00
|
|
|
Disabled: <Switch size="small" checked={disabled} onChange={this.handleDisabledChange} />
|
2020-07-07 23:04:27 +08:00
|
|
|
</>
|
2016-11-21 16:37:04 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default Demo;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2016-11-29 13:17:08 +08:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.code-box-demo .ant-slider {
|
|
|
|
margin-bottom: 16px;
|
|
|
|
}
|
|
|
|
</style>
|