diff --git a/src/components/headView.vue b/src/components/headView.vue index d0ccdeb..5954c43 100644 --- a/src/components/headView.vue +++ b/src/components/headView.vue @@ -3,7 +3,7 @@ import { reactive, ref, provide, nextTick, onMounted, inject } from "vue"; import areaList from "./areaList.vue"; import { useRoute, useRouter } from "vue-router"; import mitt from "@/utils/mitt"; -import { getStreet } from "@/api/index.js"; +import { getStreet, getArea } from "@/api/index.js"; import { useAppStore } from "@/store/app.js"; import { useUserStore } from "@/store/user.js"; import axios from "axios"; @@ -71,6 +71,19 @@ const initList = async () => { } mitt.emit('map_info', info); } +const initList2 = async () => { + getArea({ + city_code: 510500 + }).then(res=>{ + console.log(res); + // list.value = res.data; + // appStore.setAddress({ + // areaCode: res.data[0].code, + // streetCode: '' + // }) + }) + mitt.emit('map_info', info); +} const router = useRouter() const route = useRoute() @@ -119,7 +132,15 @@ const initWeather = (city = 510500) => { onMounted(() => { + console.log(route); + if(route.query.areaCode){ + appStore.setAddress({ + areaCode: route.query.areaCode, + streetCode: route.query.streetCode||'' + }) + } initList(); + initList2(); // 每秒钟更新一次时间 setInterval(updateClock, 1000); @@ -158,10 +179,10 @@ onMounted(() => { {{ weather }} - + diff --git a/src/view/index/components/centerMap.vue b/src/view/index/components/centerMap.vue index 882d42a..8d3bd2f 100644 --- a/src/view/index/components/centerMap.vue +++ b/src/view/index/components/centerMap.vue @@ -178,7 +178,7 @@ const initMap = () => { } if (obj) { return `