Merge pull request #1431 from rijn/1134
Add watchers for min and max in inputNumber
This commit is contained in:
commit
06290cb3a9
2 changed files with 12 additions and 1 deletions
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Input-number :max="10" name="he" :min="-1" v-model="v1" :autofocus="autofocus"></Input-number>
|
<Input-number :max="max" name="he" :min="-1" v-model="v1" :autofocus="autofocus"></Input-number>
|
||||||
{{ v1 }}
|
{{ v1 }}
|
||||||
<div @click="c">change v1</div>
|
<div @click="c">change v1</div>
|
||||||
|
<div @click="changeMax">change max</div>
|
||||||
<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>
|
<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>
|
||||||
<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>
|
<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
return {
|
return {
|
||||||
v1: 1,
|
v1: 1,
|
||||||
v2: 1,
|
v2: 1,
|
||||||
|
max: 10,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
obj: {
|
obj: {
|
||||||
|
|
||||||
|
@ -24,6 +26,9 @@
|
||||||
methods: {
|
methods: {
|
||||||
c () {
|
c () {
|
||||||
this.v1 = 5;
|
this.v1 = 5;
|
||||||
|
},
|
||||||
|
changeMax () {
|
||||||
|
this.max++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -273,6 +273,12 @@
|
||||||
},
|
},
|
||||||
currentValue (val) {
|
currentValue (val) {
|
||||||
this.changeVal(val);
|
this.changeVal(val);
|
||||||
|
},
|
||||||
|
min () {
|
||||||
|
this.changeVal(this.currentValue);
|
||||||
|
},
|
||||||
|
max () {
|
||||||
|
this.changeVal(this.currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue