Commit 457d6c69fc72001832b1d6598e343a6b038bc7be
1 parent
7adf94a2
add prop active-change
Showing
2 changed files
with
10 additions
and
2 deletions
Show diff stats
examples/routers/input-number.vue
... | ... | @@ -57,6 +57,10 @@ |
57 | 57 | <InputNumber v-model="valueNull" style="width: 200px" :min='1' :max='10000' :precision='2' ></InputNumber> |
58 | 58 | <InputNumber v-model="valueNull" style="width: 200px" ></InputNumber> |
59 | 59 | <div style="margin:10px 0px"> |
60 | + <InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" :min='1' :max='10000' :precision='2' ></InputNumber> | |
61 | + <InputNumber :activeChange="false" v-model="valueNull" style="width: 200px" ></InputNumber> | |
62 | + </div> | |
63 | + <div style="margin:10px 0px"> | |
60 | 64 | <InputNumber |
61 | 65 | :max="10000" |
62 | 66 | v-model="value9" | ... | ... |
src/components/input-number/input-number.vue
... | ... | @@ -80,6 +80,10 @@ |
80 | 80 | type: Number, |
81 | 81 | default: 1 |
82 | 82 | }, |
83 | + activeChange:{ | |
84 | + type:Boolean, | |
85 | + default:true | |
86 | + }, | |
83 | 87 | value: { |
84 | 88 | type: Number, |
85 | 89 | default: 1 |
... | ... | @@ -286,7 +290,7 @@ |
286 | 290 | }, |
287 | 291 | change (event) { |
288 | 292 | |
289 | - if (event.type == 'input') return; | |
293 | + if (event.type == 'input' && !this.activeChange) return; | |
290 | 294 | let val = event.target.value.trim(); |
291 | 295 | if (this.parser) { |
292 | 296 | val = this.parser(val); |
... | ... | @@ -297,7 +301,7 @@ |
297 | 301 | this.setValue(null); |
298 | 302 | return; |
299 | 303 | } |
300 | - //if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later | |
304 | + if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later | |
301 | 305 | |
302 | 306 | val = Number(val); |
303 | 307 | ... | ... |