input 支持 focus 方法
This commit is contained in:
parent
7ec0b5330b
commit
545add717e
1 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
<i class="ivu-icon ivu-icon-load-c ivu-load-loop" :class="[prefixCls + '-icon', prefixCls + '-icon-validate']" v-if="!icon"></i>
|
<i class="ivu-icon ivu-icon-load-c ivu-load-loop" :class="[prefixCls + '-icon', prefixCls + '-icon-validate']" v-if="!icon"></i>
|
||||||
</transition>
|
</transition>
|
||||||
<input
|
<input
|
||||||
|
ref="input"
|
||||||
:type="type"
|
:type="type"
|
||||||
:class="inputClasses"
|
:class="inputClasses"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
|
@ -194,6 +195,13 @@
|
||||||
const maxRows = autosize.maxRows;
|
const maxRows = autosize.maxRows;
|
||||||
|
|
||||||
this.textareaStyles = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
|
this.textareaStyles = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
|
||||||
|
},
|
||||||
|
focus() {
|
||||||
|
if (this.type === 'textarea') {
|
||||||
|
this.$refs.textarea.focus();
|
||||||
|
} else {
|
||||||
|
this.$refs.input.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue