Input 组件增加autofocus属性

This commit is contained in:
丁强 2017-04-25 16:52:51 +08:00
parent 05e2dda017
commit f15c216a51
4 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<Input-number :max="10" :min="-1" v-model="v1"></Input-number> <Input-number :max="10" :min="-1" v-model="v1" autofocus></Input-number>
{{ v1 }} {{ v1 }}
<div @click="c">change v1</div> <div @click="c">change v1</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>

View file

@ -1,6 +1,6 @@
<template> <template>
<div style="width: 300px;"> <div style="width: 300px;">
<i-input v-model="value11" icon="ios-clock-outline"> <i-input v-model="value11" icon="ios-clock-outline" autofocus>
<span slot="prepend">.com</span> <span slot="prepend">.com</span>
</i-input> </i-input>
<i-input v-model="value11" icon="ios-clock-outline"> <i-input v-model="value11" icon="ios-clock-outline">

View file

@ -19,6 +19,7 @@
:class="inputClasses" :class="inputClasses"
:disabled="disabled" :disabled="disabled"
autocomplete="off" autocomplete="off"
:autofocus="autofocus"
@focus="focus" @focus="focus"
@blur="blur" @blur="blur"
@keydown.stop="keyDown" @keydown.stop="keyDown"
@ -89,6 +90,9 @@
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
},
autofocus: {
type: String
} }
}, },
data () { data () {

View file

@ -16,6 +16,7 @@
:name="name" :name="name"
:value="currentValue" :value="currentValue"
:number="number" :number="number"
:autofocus="autofocus"
@keyup.enter="handleEnter" @keyup.enter="handleEnter"
@focus="handleFocus" @focus="handleFocus"
@blur="handleBlur" @blur="handleBlur"
@ -98,6 +99,9 @@
number: { number: {
type: Boolean, type: Boolean,
default: false default: false
},
autofocus: {
type: String
} }
}, },
data () { data () {