Browse Source

improve input number demos

pull/47/head
afc163 9 years ago
parent
commit
207041879b
  1. 28
      components/input-number/demo/basic.md
  2. 34
      components/input-number/demo/disabled.md
  3. 2
      components/input-number/index.jsx

28
components/input-number/demo/basic.md

@ -9,30 +9,12 @@
````jsx
var InputNumber = antd.InputNumber;
function onChange(v){
console.log('changed',v);
function onChange(value) {
console.log('changed', value);
}
var Test = React.createClass({
getInitialState(){
return {
disabled:false
};
},
toggle(){
this.setState({
disabled:!this.state.disabled
});
},
render(){
return <div>
<InputNumber min={1} max={10} disabled={this.state.disabled} defaultValue={3} onChange={onChange} style={{width:100}}/>
&nbsp;&nbsp;&nbsp;
<button onClick={this.toggle} className="ant-btn ant-btn-primary"> toggle disabled</button>
</div>;
}
});
React.render(<Test />, document.getElementById('components-input-number-demo-basic'));
React.render(
<InputNumber min={1} max={10} defaultValue={3} onChange={onChange} style={{width:100}} />
, document.getElementById('components-input-number-demo-basic'));
````

34
components/input-number/demo/disabled.md

@ -0,0 +1,34 @@
# 不可用
- order: 0
点击按钮切换可用状态。
---
````jsx
var InputNumber = antd.InputNumber;
var Test = React.createClass({
getInitialState() {
return {
disabled:false
};
},
toggle() {
this.setState({
disabled: !this.state.disabled
});
},
render() {
return <div>
<InputNumber min={1} max={10} disabled={this.state.disabled} defaultValue={3} style={{width:100}} />
<br />
<br />
<button onClick={this.toggle} className="ant-btn ant-btn-primary">Toggle disabled</button>
</div>;
}
});
React.render(<Test />, document.getElementById('components-input-number-demo-disabled'));
````

2
components/input-number/index.jsx

@ -8,7 +8,7 @@ var AntInputNumber = React.createClass({
};
},
render() {
return <InputNumber {...this.props}/>;
return <InputNumber {...this.props} />;
}
});

Loading…
Cancel
Save