1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import InputNumber from '../src/index';
import '../assets/index.less';
export default {
data: function data() {
return {
disabled: false,
readOnly: false,
value: 5
};
},
methods: {
onChange: function onChange(value) {
console.log('onChange:', value);
this.value = value;
},
toggleDisabled: function toggleDisabled() {
this.disabled = !this.disabled;
},
toggleReadOnly: function toggleReadOnly() {
this.readOnly = !this.readOnly;
}
},
render: function render() {
var h = arguments[0];
return h(
'div',
{ style: 'margin: 10px;' },
[h(InputNumber, {
attrs: {
min: -8,
max: 10,
value: this.value,
readOnly: this.readOnly,
disabled: this.disabled,
useTouch: true
},
style: 'width: 100px',
on: {
'change': this.onChange
}
}), h(
'p',
{ style: 'padding:10px 0' },
[h(
'button',
{
on: {
'click': this.toggleDisabled
}
},
['toggle Disabled']
), h(
'button',
{
on: {
'click': this.toggleReadOnly
}
},
['toggle readOnly']
)]
)]
);
}
};