ant-design-vue/components/vc-input-number/demo/precision.jsx

31 lines
680 B
Vue
Raw Normal View History

2019-01-12 03:33:27 +00:00
import InputNumber from '../src/index';
import '../assets/index.less';
2018-04-04 04:04:49 +00:00
export default {
2019-01-12 03:33:27 +00:00
data() {
2018-04-04 04:04:49 +00:00
return {
precision: 2,
2019-01-12 03:33:27 +00:00
};
2018-04-04 04:04:49 +00:00
},
methods: {
2019-01-12 03:33:27 +00:00
onChange(value) {
console.log('onChange:', value);
this.value = value;
2018-04-04 04:04:49 +00:00
},
2019-01-12 03:33:27 +00:00
changeprecision(e) {
this.precision = parseInt(e.target.value, 10);
2018-04-04 04:04:49 +00:00
},
},
2019-01-12 03:33:27 +00:00
render() {
2018-04-04 04:04:49 +00:00
return (
2019-01-12 03:33:27 +00:00
<div style="margin: 10px;">
<InputNumber defaultValue={1} onChange={this.onChange} precision={this.precision} />
<p style="padding:10px 0">
2018-04-04 04:04:49 +00:00
precision:
2019-01-12 03:33:27 +00:00
<input type="number" onInput={this.changeprecision} value={this.precision} />
2018-04-04 04:04:49 +00:00
</p>
</div>
2019-01-12 03:33:27 +00:00
);
2018-04-04 04:04:49 +00:00
},
2019-01-12 03:33:27 +00:00
};