From 8b94b16caab33304718a2715ed87327382c46e11 Mon Sep 17 00:00:00 2001 From: qiuchenfan <2035024011@qq.com> Date: Fri, 14 Nov 2025 19:07:37 +0800 Subject: [PATCH] 222 --- 1114/app/components/weather/WeatherCard.tsx | 6 +++--- .../{WeatherDetailsCrid.tsx => WeatherDetailsGrid.tsx} | 5 ++++- 1114/app/components/weather/WeatherSearchForm.tsx | 4 ++-- 1114/app/routes/weather.tsx | 10 +++++----- 1114/app/services/weatherApi.ts | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) rename 1114/app/components/weather/{WeatherDetailsCrid.tsx => WeatherDetailsGrid.tsx} (94%) diff --git a/1114/app/components/weather/WeatherCard.tsx b/1114/app/components/weather/WeatherCard.tsx index a44ccc8..1f8b3af 100644 --- a/1114/app/components/weather/WeatherCard.tsx +++ b/1114/app/components/weather/WeatherCard.tsx @@ -1,6 +1,6 @@ -import { WeathersearchForm } from "@/components/weather/WeatherSearchForm"; +import { WeatherSearchForm } from "@/components/weather/WeatherSearchForm"; import { WeatherDisplay } from "@/components/weather/WeatherDisplay"; -import { WeatherDetailsGrid } from "@/components/weather/WeatherDetailsCrid"; +import { WeatherDetailsGrid } from "@/components/weather/WeatherDetailsGrid"; import { useWeatherStore } from "@/store/weatherStore"; import Cloud from "../../../assets/cloud.svg"; @@ -9,7 +9,7 @@ export function WeatherCard() { return (
- + {currentWeather ? (
diff --git a/1114/app/components/weather/WeatherDetailsCrid.tsx b/1114/app/components/weather/WeatherDetailsGrid.tsx similarity index 94% rename from 1114/app/components/weather/WeatherDetailsCrid.tsx rename to 1114/app/components/weather/WeatherDetailsGrid.tsx index 837db65..d3cbb85 100644 --- a/1114/app/components/weather/WeatherDetailsCrid.tsx +++ b/1114/app/components/weather/WeatherDetailsGrid.tsx @@ -10,7 +10,8 @@ interface WeatherInfoItemProps { subtitle?: string; } -function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) { +export function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) { + return (
@@ -28,6 +29,8 @@ function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) export function WeatherDetailsGrid() { + const {currentWeather} = useWeatherStore(); + if (!currentWeather) return null; <>
{ if (error) { toast.error(error) - seterror("") + setError("") } - }, [error, seterror]) + }, [error, setError]) return (
diff --git a/1114/app/services/weatherApi.ts b/1114/app/services/weatherApi.ts index e40a53a..0f2a275 100644 --- a/1114/app/services/weatherApi.ts +++ b/1114/app/services/weatherApi.ts @@ -1,5 +1,5 @@ import axios, {type AxiosInstance,AxiosError} from 'axios'; -import {WeatherData} from "@/store/weatherStore"; +import {type WeatherData} from "@/store/weatherStore"; //配置常量 const API_KEY = '5097cc3212ea9c460b01e2be936c94d5';