From 2e28702b8c14bfc003854afcb54db154cc7d4c33 Mon Sep 17 00:00:00 2001 From: rex Date: Mon, 18 Feb 2019 13:33:30 +0800 Subject: [PATCH] [improvement] Area: setValues in one micro task --- packages/area/index.ts | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/area/index.ts b/packages/area/index.ts index 6620f94c..3dc819f1 100644 --- a/packages/area/index.ts +++ b/packages/area/index.ts @@ -148,26 +148,30 @@ VantComponent({ const stack = []; - stack.push(picker.setColumnValues(0, province)); - stack.push(picker.setColumnValues(1, city)); + stack.push(picker.setColumnValues(0, province, false)); + stack.push(picker.setColumnValues(1, city, false)); if (city.length && code.slice(2, 4) === '00') { ;[{ code }] = city; } stack.push( - picker.setColumnValues(2, this.getList('county', code.slice(0, 4))) + picker.setColumnValues( + 2, + this.getList('county', code.slice(0, 4)), + false + ) ); - return Promise.all(stack) - .then(() => - picker.setIndexes([ - this.getIndex('province', code), - this.getIndex('city', code), - this.getIndex('county', code) - ]) - ) - .catch(() => {}); + stack.push( + picker.setIndexes([ + this.getIndex('province', code), + this.getIndex('city', code), + this.getIndex('county', code) + ]) + ); + + return Promise.all(stack).catch(() => {}); }, getValues() {