Commit 020e3908 authored by 方建宇's avatar 方建宇

顶部天气组件-静态数据

parent 89f10206
export const homeWeatherReal={
"data": {
"weatherId": "5c9ee7dc-db53-4041-ab91-a12bd89fc4bd",
"temperature": -0.6,
"wind": 1.8,
"illumination": 32.0,
"windDirection": "",
"humidity": 0.0,
"gatherTime": "2025-01-09 15:15:47"
}
}
......@@ -404,6 +404,7 @@ import {
import { useRoute, useRouter, onBeforeRouteUpdate } from "vue-router";
import store from "../store/index";
import http from "../api/http";
import{homeWeatherReal} from "../dataJson/home/homeModule.js"
//引入cookie
import jsCookie from"js-cookie";
import {
......@@ -558,13 +559,19 @@ export default defineComponent({
// 在组件即将挂载之前加载数据
await getData();
});
//天气组件实时更新
// const getWeather = async () => {
// var result = await http.post(
// "/api/weather/Real/",
// showWeatherData.supplyData.supplyId
// );
// var temp = result.data;
// var tempWeatherData = toRefs(showWeatherData);
// tempWeatherData.weatherData.value = temp;
// };
// 静态天气
const getWeather = async () => {
var result = await http.post(
"/api/weather/Real/",
showWeatherData.supplyData.supplyId
);
var temp = result.data;
var temp = homeWeatherReal.data;
var tempWeatherData = toRefs(showWeatherData);
tempWeatherData.weatherData.value = temp;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment