From 06010019502602981be1daa08250a2cb30f06c46 Mon Sep 17 00:00:00 2001 From: Jake Date: Fri, 26 Jul 2019 10:03:37 +0800 Subject: [PATCH] [bugfix] Field: Modified value invalid --- packages/search/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/search/index.ts b/packages/search/index.ts index fba32f2d..7a0088cb 100644 --- a/packages/search/index.ts +++ b/packages/search/index.ts @@ -37,9 +37,15 @@ VantComponent({ }, onCancel() { - this.set({ value: '' }); - this.$emit('cancel'); - this.$emit('change', ''); + /** + * 修复修改输入框值时,输入框失焦和赋值同时触发,赋值失效 + * // https://github.com/youzan/vant-weapp/issues/1768 + */ + setTimeout(() => { + this.set({ value: '' }); + this.$emit('cancel'); + this.$emit('change', ''); + }, 200); }, onSearch() {