You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
726 B
42 lines
726 B
5 years ago
|
---
|
||
|
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 (
|
||
|
<div>
|
||
|
<Slider defaultValue={30} reverse={reverse} />
|
||
|
<Slider range defaultValue={[20, 50]} reverse={reverse} />
|
||
|
Reversed: <Switch size="small" checked={reverse} onChange={this.handleReverseChange} />
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ReactDOM.render(<Demo />, mountNode);
|
||
|
```
|