From 8e003a0ee7ee7629b3d6916db45fd3fa88e48a5d Mon Sep 17 00:00:00 2001 From: Vopdoo Chen <42235710+vopdoo@users.noreply.github.com> Date: Tue, 2 Oct 2018 08:25:47 +0800 Subject: [PATCH] fixed Cannot read property county_list of null (#684) --- packages/area/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/area/index.ts b/packages/area/index.ts index 250e9de1..e044845d 100644 --- a/packages/area/index.ts +++ b/packages/area/index.ts @@ -89,7 +89,7 @@ VantComponent({ return result; } - const list = this.data.areaList[`${type}_list`] || {}; + const list = this.data.areaList && this.data.areaList[`${type}_list`] || {}; result = Object.keys(list).map(code => ({ code, name: list[code] @@ -117,7 +117,7 @@ VantComponent({ }, setValues() { - let code = this.code || Object.keys(this.data.areaList.county_list || {})[0] || ''; + let code = this.code || this.data.areaList && Object.keys(this.data.areaList.county_list || {})[0] || ''; const province = this.getList('province'); const city = this.getList('city', code.slice(0, 2));