2019-09-06 16:35:13 +08:00
|
|
|
---
|
|
|
|
order: 8
|
|
|
|
title:
|
|
|
|
zh-CN: 反向
|
|
|
|
en-US: Reverse
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
设置 `reverse` 可以将滑动条置反。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Using `reverse` to render slider reversely.
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
import { Slider, Switch } from 'antd';
|
|
|
|
|
|
|
|
class Demo extends React.Component {
|
|
|
|
state = {
|
|
|
|
reverse: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
handleReverseChange = reverse => {
|
|
|
|
this.setState({ reverse });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { reverse } = this.state;
|
|
|
|
return (
|
2020-07-07 23:04:27 +08:00
|
|
|
<>
|
2019-09-06 16:35:13 +08:00
|
|
|
<Slider defaultValue={30} reverse={reverse} />
|
|
|
|
<Slider range defaultValue={[20, 50]} reverse={reverse} />
|
|
|
|
Reversed: <Switch size="small" checked={reverse} onChange={this.handleReverseChange} />
|
2020-07-07 23:04:27 +08:00
|
|
|
</>
|
2019-09-06 16:35:13 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
|
|
|
```
|