mirror of
https://github.com/wassname/slider.git
synced 2026-09-11 12:42:49 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f39212df5 | ||
|
|
a7c2319949 |
+7
-6
@@ -8,6 +8,7 @@ var Slider = require('rc-slider');
|
|||||||
|
|
||||||
var style = {width: 400, margin: 50};
|
var style = {width: 400, margin: 50};
|
||||||
var marks = {
|
var marks = {
|
||||||
|
'-10': '-10°C',
|
||||||
0: '0°C',
|
0: '0°C',
|
||||||
26: '26°C',
|
26: '26°C',
|
||||||
37: '37°C',
|
37: '37°C',
|
||||||
@@ -22,29 +23,29 @@ ReactDOM.render(
|
|||||||
<div>
|
<div>
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Slider with marks, `included=true`</p>
|
<p>Slider with marks, `included=true`</p>
|
||||||
<Slider marks={marks} onChange={log} defaultValue={20} />
|
<Slider min={-10} marks={marks} onChange={log} defaultValue={20} />
|
||||||
</div>
|
</div>
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Slider with marks and steps, `included=true`</p>
|
<p>Slider with marks and steps, `included=true`</p>
|
||||||
<Slider marks={marks} step={10} onChange={log} defaultValue={20} />
|
<Slider min={-10} marks={marks} step={10} onChange={log} defaultValue={20} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Slider with marks, `included=false`</p>
|
<p>Slider with marks, `included=false`</p>
|
||||||
<Slider marks={marks} included={false} defaultValue={20} />
|
<Slider min={-10} marks={marks} included={false} defaultValue={20} />
|
||||||
</div>
|
</div>
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Slider with marks and steps, `included=false`</p>
|
<p>Slider with marks and steps, `included=false`</p>
|
||||||
<Slider marks={marks} step={10} included={false} defaultValue={20} />
|
<Slider min={-10} marks={marks} step={10} included={false} defaultValue={20} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Range with marks</p>
|
<p>Range with marks</p>
|
||||||
<Slider range marks={marks} onChange={log} defaultValue={[20, 40]} />
|
<Slider min={-10} range marks={marks} onChange={log} defaultValue={[20, 40]} />
|
||||||
</div>
|
</div>
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
<p>Range with marks and steps</p>
|
<p>Range with marks and steps</p>
|
||||||
<Slider range marks={marks} step={10} onChange={log} defaultValue={[20, 40]} />
|
<Slider min={-10} range marks={marks} step={10} onChange={log} defaultValue={[20, 40]} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
, document.getElementById('__react-content'));
|
, document.getElementById('__react-content'));
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-slider",
|
"name": "rc-slider",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"description": "slider ui component for react",
|
"description": "slider ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|||||||
+1
-7
@@ -17,13 +17,7 @@ const Marks = ({className, marks, included, upperBound, lowerBound, max, min}) =
|
|||||||
});
|
});
|
||||||
|
|
||||||
const style = { width: markWidth };
|
const style = { width: markWidth };
|
||||||
if (point === marksCount - 1) {
|
style.left = (point - min) / range * 100 - unit / 4 + '%';
|
||||||
style.right = -unit / 4 + '%';
|
|
||||||
} else if (point === 0) {
|
|
||||||
style.left = -unit / 4 + '%';
|
|
||||||
} else {
|
|
||||||
style.left = (point - min) / range * 100 - unit / 4 + '%';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (<span className={markClassName} style={style} key={point}>
|
return (<span className={markClassName} style={style} key={point}>
|
||||||
{marks[point]}
|
{marks[point]}
|
||||||
|
|||||||
Reference in New Issue
Block a user