add prop active-change

This commit is contained in:
huanghong 2018-08-28 15:15:49 +08:00
parent 7adf94a291
commit 457d6c69fc
2 changed files with 10 additions and 2 deletions

View file

@ -56,6 +56,10 @@
<InputNumber v-model="valueNull" style="width: 200px" :min='1' :max='10000' :precision='2' ></InputNumber>
<InputNumber v-model="valueNull" style="width: 200px" ></InputNumber>
<div style="margin:10px 0px">
<InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" :min='1' :max='10000' :precision='2' ></InputNumber>
<InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" ></InputNumber>
</div>
<div style="margin:10px 0px">
<InputNumber
:max="10000"

View file

@ -80,6 +80,10 @@
type: Number,
default: 1
},
activeChange:{
type:Boolean,
default:true
},
value: {
type: Number,
default: 1
@ -286,7 +290,7 @@
},
change (event) {
if (event.type == 'input') return;
if (event.type == 'input' && !this.activeChange) return;
let val = event.target.value.trim();
if (this.parser) {
val = this.parser(val);
@ -297,7 +301,7 @@
this.setValue(null);
return;
}
//if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later
if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later
val = Number(val);