Skip to content

Commit

Permalink
fix(runtime): 修复百度小程序 input 跳焦问题, fix #6943
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Jul 13, 2020
1 parent bab4938 commit ad897eb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/taro-runtime/src/dom/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ export class FormElement extends TaroElement {
}

public dispatchEvent (event: TaroEvent) {
if (
(event.type === 'input' || event.type === 'change') &&
event.mpEvent &&
(isString(event.mpEvent.detail.value) || isBoolean(event.mpEvent.detail.value) || isNumber(event.mpEvent.detail.value) || isArray(event.mpEvent.detail.value))
) {
this.value = event.mpEvent.detail.value
if ((event.type === 'input' || event.type === 'change') && event.mpEvent) {
let val = event.mpEvent.detail.value
if (isNumber(val) || isArray(val)) {
val = JSON.stringify(val)
}
if (isString(val) || isBoolean(val)) {
this.props.value = val as string
}
}
return super.dispatchEvent(event)
}
Expand Down

0 comments on commit ad897eb

Please sign in to comment.