Files
slider/examples/simple.js
T
2015-11-14 12:46:13 +08:00

52 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
require('rc-slider/assets/index.less');
var React = require('react');
var ReactDOM = require('react-dom');
var Slider = require('rc-slider');
var style = {width:400,margin:50};
var log = console.log.bind(console);
function percentFormatter(v) {
return v + " %";
}
ReactDOM.render(
<div>
<div style={style}>
<p>基础滑块</p>
<Slider onChange={log} tipTransitionName='rc-slider-tooltip-zoom-down' />
</div>
<div style={style}>
<p>基础滑块step=20</p>
<Slider step={20} />
</div>
<div style={style}>
<p>基础滑块step=20 带圆点</p>
<Slider dots step={20} />
</div>
<div style={style}>
<p>双滑块</p>
<Slider range min={10} max={90} defaultValue={[0, 30]} onChange={log} />
</div>
<div style={style}>
<p>双滑块step=20 </p>
<Slider range dots step={20} defaultValue={[0, 30]} onAfterChange={log} included={false} />
</div>
<div style={style}>
<p>分段式滑块包含关系</p>
<Slider marks={["状态1","状态2","状态3","状态4"]} defaultIndex={1} />
</div>
<div style={style}>
<p>分段式滑块并列关系</p>
<Slider marks={["状态1","状态2","状态3","状态4"]} included={false} defaultIndex={1} />
</div>
<div style={style}>
<p>基础滑块</p>
<Slider onChange={log} tipFormatter={percentFormatter} tipTransitionName='rc-slider-tooltip-zoom-down' />
</div>
</div>
, document.getElementById('__react-content'));