Commit f15c216a51c615681bba307f5db572fe5fde1abe
1 parent
05e2dda0
Input 组件增加autofocus属性
Showing
4 changed files
with
10 additions
and
2 deletions
Show diff stats
examples/routers/input-number.vue
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | - <Input-number :max="10" :min="-1" v-model="v1"></Input-number> | |
| 3 | + <Input-number :max="10" :min="-1" v-model="v1" autofocus></Input-number> | |
| 4 | 4 | {{ v1 }} |
| 5 | 5 | <div @click="c">change v1</div> |
| 6 | 6 | <Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number> | ... | ... |
examples/routers/input.vue
src/components/input-number/input-number.vue
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | :class="inputClasses" |
| 20 | 20 | :disabled="disabled" |
| 21 | 21 | autocomplete="off" |
| 22 | + :autofocus="autofocus" | |
| 22 | 23 | @focus="focus" |
| 23 | 24 | @blur="blur" |
| 24 | 25 | @keydown.stop="keyDown" |
| ... | ... | @@ -89,6 +90,9 @@ |
| 89 | 90 | disabled: { |
| 90 | 91 | type: Boolean, |
| 91 | 92 | default: false |
| 93 | + }, | |
| 94 | + autofocus: { | |
| 95 | + type: String | |
| 92 | 96 | } |
| 93 | 97 | }, |
| 94 | 98 | data () { | ... | ... |
src/components/input/input.vue
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | :name="name" |
| 17 | 17 | :value="currentValue" |
| 18 | 18 | :number="number" |
| 19 | + :autofocus="autofocus" | |
| 19 | 20 | @keyup.enter="handleEnter" |
| 20 | 21 | @focus="handleFocus" |
| 21 | 22 | @blur="handleBlur" |
| ... | ... | @@ -98,6 +99,9 @@ |
| 98 | 99 | number: { |
| 99 | 100 | type: Boolean, |
| 100 | 101 | default: false |
| 102 | + }, | |
| 103 | + autofocus: { | |
| 104 | + type: String | |
| 101 | 105 | } |
| 102 | 106 | }, |
| 103 | 107 | data () { | ... | ... |