diff --git a/src/components/areaMap.vue b/src/components/areaMap.vue index bca3da0..bd6634e 100644 --- a/src/components/areaMap.vue +++ b/src/components/areaMap.vue @@ -348,6 +348,7 @@ const initTownMap = async (name) => { ...areaStore.userInfo }) + console.log(showArea.value,"res") res.data.list.forEach(item => { @@ -367,7 +368,6 @@ const initTownMap = async (name) => { return item.properties.name == name }) - var mapName = 'town'; const myChart = document.getElementById("chart3") let option = { @@ -588,9 +588,12 @@ const initTownMap = async (name) => { // ) -watch(() => areaStore.userInfo, (value, oldValue) => { - if (value.areaCode) { - switch (value.areaCode) { +watch(() => areaStore.userInfo.areaCode, (value, oldValue) => { + +console.log(value,'value') + + if (value) { + switch (value) { case "510503": geoJson = geoJsonNaxi break; @@ -645,7 +648,7 @@ globalEventBus.on('choseTown', data => { areaStore.areaCodeList.forEach(item => { if (item.name == (data.name)) { - areaStore.changeUserInfoFn(510521, item.code) + areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code) } }) areaStore.changeAddress('', data.name )