From 859eed4a080d39378432e39adf96caddde8eb32d Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Tue, 2 Jan 2024 18:05:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/headView.vue | 27 ++++++++++++++++++++++--- src/view/index/components/centerMap.vue | 4 ++-- 2 files changed, 26 insertions(+), 5 deletions(-) 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 `