Merge pull request #1431 from rijn/1134

Add watchers for min and max in inputNumber
This commit is contained in:
Aresn 2017-08-02 10:53:22 +08:00 committed by GitHub
commit 06290cb3a9
2 changed files with 12 additions and 1 deletions

View file

@ -1,8 +1,9 @@
<template>
<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 }}
<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 :max="10" :min="1" v-model="obj.v"></Input-number>
</div>
@ -14,6 +15,7 @@
return {
v1: 1,
v2: 1,
max: 10,
autofocus: true,
obj: {
@ -24,6 +26,9 @@
methods: {
c () {
this.v1 = 5;
},
changeMax () {
this.max++;
}
}
};

View file

@ -273,6 +273,12 @@
},
currentValue (val) {
this.changeVal(val);
},
min () {
this.changeVal(this.currentValue);
},
max () {
this.changeVal(this.currentValue);
}
}
};