From ad897ebbbcadd41fa1bffbc5501445524c285c77 Mon Sep 17 00:00:00 2001 From: chenjiajian <798095202@qq.com> Date: Wed, 8 Jul 2020 17:38:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(runtime):=20=E4=BF=AE=E5=A4=8D=E7=99=BE?= =?UTF-8?q?=E5=BA=A6=E5=B0=8F=E7=A8=8B=E5=BA=8F=20input=20=E8=B7=B3?= =?UTF-8?q?=E7=84=A6=E9=97=AE=E9=A2=98,=20fix=20#6943?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-runtime/src/dom/form.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/taro-runtime/src/dom/form.ts b/packages/taro-runtime/src/dom/form.ts index fd61f8a3f642..63588f7fc73c 100644 --- a/packages/taro-runtime/src/dom/form.ts +++ b/packages/taro-runtime/src/dom/form.ts @@ -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) }