Skip to content

Commit

Permalink
fix(h5): 修复 input 改变 focus 值时不聚焦的问题,fix #9777
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Jul 19, 2021
1 parent cccf328 commit f89189f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/taro-components/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ export class Input implements ComponentInterface {
@Element() el: HTMLElement

@Watch('value')
watchHandler(newValue: string, oldValue: string) {
watchHandler (newValue: string, oldValue: string) {
if (newValue !== oldValue) {
this._value = newValue
}
}

@Watch('autoFocus')
watchFocus (newValue: boolean, oldValue: boolean) {
if (!oldValue && newValue) {
this.inputRef.focus()
}
}

@Event({
eventName: 'input'
}) onInput: EventEmitter
Expand Down

0 comments on commit f89189f

Please sign in to comment.