Merge branch 'master' of github.com:9th-js/wcui
commit
c2ebc91196
|
@ -355,6 +355,8 @@ class Input extends Component {
|
|||
<input
|
||||
ref="input"
|
||||
@input=${this.onInput}
|
||||
@change=${this.onChange}
|
||||
@keydown=${this.onKeyDown}
|
||||
placeholder=${this.placeholder}
|
||||
maxlength=${this.maxlength}
|
||||
minlength=${this.minlength}
|
||||
|
@ -377,6 +379,14 @@ class Input extends Component {
|
|||
this.$refs.input.value = ''
|
||||
this.value = ''
|
||||
}
|
||||
onChange() {
|
||||
this.$emit('change')
|
||||
}
|
||||
onKeyDown(e) {
|
||||
if (e.keyCode === 13) {
|
||||
this.$emit('submit')
|
||||
}
|
||||
}
|
||||
mounted() {
|
||||
if (this.autofocus) {
|
||||
// 火狐浏览器需要手动focus()才能聚焦成功
|
||||
|
|
Loading…
Reference in New Issue