Merge pull request #3395 from angela-1/dev-inputnumber

实现InputNumber获取焦点时选中已有值,增加on-focus的返回值event。
This commit is contained in:
Aresn 2018-04-16 10:07:49 +08:00 committed by GitHub
commit 07e122c682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -48,6 +48,8 @@
<InputNumber v-model="valueNull" @on-change="change" style="width: 200px"></InputNumber>
<InputNumber v-model="valueNull" @on-change="change" :formatter="formatter" :parser="parser" style="width: 200px"></InputNumber>
<InputNumber v-model="value2" @on-focus="focus" style="width: 200px"></InputNumber>
</div>
</template>
<script>
@ -64,6 +66,9 @@
}
},
methods: {
focus (e) {
e.target.select()
},
change (v) {
console.log(v)
}

View file

@ -26,6 +26,7 @@
@blur="blur"
@keydown.stop="keyDown"
@input="change"
@mouseup="preventDefault"
@change="change"
:readonly="readonly || !editable"
:name="name"
@ -250,9 +251,9 @@
this.dispatch('FormItem', 'on-form-change', val);
});
},
focus () {
focus (event) {
this.focused = true;
this.$emit('on-focus');
this.$emit('on-focus', event);
},
blur () {
this.focused = false;