fix input type

pull/449/head
baiyaaaaa 2016-10-17 11:17:13 +08:00
parent 0f7158ab78
commit cfed2184bc
2 changed files with 7 additions and 22 deletions

View File

@ -200,7 +200,6 @@
```html ```html
<el-input <el-input
placeholder="请输入内容" placeholder="请输入内容"
:number="true"
v-model="input"> v-model="input">
</el-input> </el-input>
``` ```
@ -636,7 +635,6 @@
| disabled | 禁用 | boolean | — | false | | disabled | 禁用 | boolean | — | false |
| size | 输入框尺寸,只在 `type!="textarea"` 时有效 | string | large, small, mini | — | | size | 输入框尺寸,只在 `type!="textarea"` 时有效 | string | large, small, mini | — |
| icon | 输入框尾部图标 | string | — | — | | icon | 输入框尾部图标 | string | — | — |
| number | 指定 model 值为 number 类型 | boolean | — | false |
| rows | 输入框行数,只对 `type="textarea"` 有效 | number | — | 2 | | rows | 输入框行数,只对 `type="textarea"` 有效 | number | — | 2 |
| autosize | 自适应内容高度,只对 `type="textarea"` 有效,可传入对象,如,{ minRows: 2, maxRows: 6 } | boolean/object | — | false | | autosize | 自适应内容高度,只对 `type="textarea"` 有效,可传入对象,如,{ minRows: 2, maxRows: 6 } | boolean/object | — | false |

View File

@ -13,27 +13,9 @@
<slot name="prepend"></slot> <slot name="prepend"></slot>
</div> </div>
<input <input
v-if="type === 'text'" v-if="type !== 'textarea'"
class="el-input__inner" class="el-input__inner"
v-model="currentValue" :type="type"
type="text"
:name="name"
:placeholder="placeholder"
:disabled="disabled"
:readonly="readonly"
:number="number"
:maxlength="maxlength"
:minlength="minlength"
:autocomplete="autoComplete"
ref="input"
@focus="handleFocus"
@blur="handleBlur"
>
<input
v-if="type === 'password'"
class="el-input__inner"
v-model="currentValue"
type="password"
:name="name" :name="name"
:placeholder="placeholder" :placeholder="placeholder"
:disabled="disabled" :disabled="disabled"
@ -42,7 +24,9 @@
:maxlength="maxlength" :maxlength="maxlength"
:minlength="minlength" :minlength="minlength"
:autocomplete="autoComplete" :autocomplete="autoComplete"
:value="value"
ref="input" ref="input"
@input="handleInput"
@focus="handleFocus" @focus="handleFocus"
@blur="handleBlur" @blur="handleBlur"
> >
@ -151,6 +135,9 @@
}, },
handleFocus(ev) { handleFocus(ev) {
this.$emit('focus', ev); this.$emit('focus', ev);
},
handleInput(ev) {
this.currentValue = ev.target.value;
} }
}, },