From f969b32736ab60b141d076f7aeaafdbd9dc1c546 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 08 Apr 2021 16:36:18 +0800 Subject: [PATCH] 调整地址三级联动api,在小程序中将地址数据分离为外置的静态文件 --- forms/chinaArea/CChinaArea.vue | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/forms/chinaArea/CChinaArea.vue b/forms/chinaArea/CChinaArea.vue index 59e0e7d..0b00296 100644 --- a/forms/chinaArea/CChinaArea.vue +++ b/forms/chinaArea/CChinaArea.vue @@ -35,7 +35,7 @@ import ChinaLocations from './ChinaLocations'; import './cChinaArea.scss'; -const { locationTree, getRegionNames } = ChinaLocations; +const { onReady, getLocationTree, getRegionNames } = ChinaLocations; export default { name: 'CChinaArea', @@ -79,6 +79,7 @@ return; } } + const locationTree = getLocationTree(); const curVal = this.itemRes.formData[this.itemRes.name]; const range = [ locationTree, @@ -123,6 +124,7 @@ this.current = current; }, updateColumns(roll) { + const locationTree = getLocationTree(); // 第一列滚动 if (roll.column === 0) { const cities = locationTree[roll.value].children; @@ -141,6 +143,7 @@ } }, handleChange(detail) { + const locationTree = getLocationTree(); const codes = []; const provice = locationTree[detail[0]]; codes[0] = provice.value; @@ -153,7 +156,9 @@ }, mounted() { if (process.env.TARO_ENV === 'weapp') { - this.handleOpen(); + onReady(() => { + this.handleOpen(); + }); } }, }; -- Gitblit v1.9.1