ant-design/components/slider/demo/basic.md
2016-11-21 16:37:04 +08:00

897 B

order title
0
zh-CN en-US
基本 Basic

zh-CN

基本滑动条。当 rangetrue 时,渲染为双滑块。当 disabledtrue 时,滑块处于不可用状态。

en-US

Basic slider. When range is true, display as dual thumb mode. When disable is true, the slider will not be interactable.

import { Slider, Switch } from 'antd';

class Demo extends React.Component {
  state = {
    disabled: false,
  };

  handleDisabledChange = (disabled) => {
    this.setState({ disabled });
  }

  render() {
    const { disabled } = this.state;
    return (
      <div>
        Disabled: <Switch checked={disabled} onChange={this.handleDisabledChange} />
        <Slider defaultValue={30} disabled={disabled} />
        <Slider range defaultValue={[20, 50]} disabled={disabled} />
      </div>
    );
  }
}

ReactDOM.render(<Demo />, mountNode);