2017-01-05 12:05:24 +08:00
|
|
|
---
|
|
|
|
order: 6
|
|
|
|
title:
|
|
|
|
zh-CN: 垂直
|
|
|
|
en-US: Vertical
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
垂直方向的 Slider。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
The vertical Slider.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2017-01-05 12:05:24 +08:00
|
|
|
import { Slider } from 'antd';
|
2022-07-04 22:09:54 +08:00
|
|
|
import type { SliderMarks } from 'antd/es/slider';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2017-01-05 12:05:24 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const style: React.CSSProperties = {
|
2019-10-29 11:24:07 +08:00
|
|
|
display: 'inline-block',
|
2017-01-05 12:05:24 +08:00
|
|
|
height: 300,
|
|
|
|
marginLeft: 70,
|
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const marks: SliderMarks = {
|
2017-01-05 12:05:24 +08:00
|
|
|
0: '0°C',
|
|
|
|
26: '26°C',
|
|
|
|
37: '37°C',
|
|
|
|
100: {
|
|
|
|
style: {
|
|
|
|
color: '#f50',
|
|
|
|
},
|
|
|
|
label: <strong>100°C</strong>,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-07-07 23:04:27 +08:00
|
|
|
<>
|
2017-01-05 12:05:24 +08:00
|
|
|
<div style={style}>
|
|
|
|
<Slider vertical defaultValue={30} />
|
|
|
|
</div>
|
|
|
|
<div style={style}>
|
|
|
|
<Slider vertical range step={10} defaultValue={[20, 50]} />
|
|
|
|
</div>
|
|
|
|
<div style={style}>
|
|
|
|
<Slider vertical range marks={marks} defaultValue={[26, 37]} />
|
|
|
|
</div>
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2017-01-05 12:05:24 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|