fix InputNumber bug in 2.4.0, and release 2.4.0-beta.3

This commit is contained in:
梁灏 2017-09-24 16:21:48 +08:00
parent 7fdad3a3ca
commit cb2678c4b9
3 changed files with 8 additions and 5 deletions

View file

@ -6,7 +6,7 @@
<!--<div @click="changeMax">change max</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>-->
{{ value1 }} <InputNumber :max="10" :min="1" :step="1.2" v-model="value2"></InputNumber>
<InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber> <InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber>
</div> </div>
</template> </template>
@ -22,7 +22,8 @@
obj: { obj: {
}, },
value1: 1.0 value1: 1.0,
value2: 1
}; };
}, },
computed: {}, computed: {},

View file

@ -1,6 +1,6 @@
{ {
"name": "iview", "name": "iview",
"version": "2.4.0-beta.2", "version": "2.4.0-beta.3",
"title": "iView", "title": "iView",
"description": "A high quality UI components Library with Vue.js", "description": "A high quality UI components Library with Vue.js",
"homepage": "http://www.iviewui.com", "homepage": "http://www.iviewui.com",

View file

@ -161,7 +161,7 @@
}, },
precisionValue () { precisionValue () {
// can not display 1.0 // can not display 1.0
return this.currentValue.toFixed(this.precision); return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue;
} }
}, },
methods: { methods: {
@ -219,7 +219,9 @@
this.setValue(val); this.setValue(val);
}, },
setValue (val) { setValue (val) {
val = Number(Number(val).toFixed(this.precision)); // step precision
if (this.precision) val = Number(Number(val).toFixed(this.precision));
this.$nextTick(() => { this.$nextTick(() => {
this.currentValue = val; this.currentValue = val;
this.$emit('input', val); this.$emit('input', val);