Compare commits

..

No commits in common. "9f4019cb948eb261f558a9ba3dacf34779b02339" and "e5f0512f05e7182943f72a5068e58a995a49fa58" have entirely different histories.

2 changed files with 5 additions and 1 deletions

View File

@ -74,6 +74,9 @@ export function WeatherSearchForm() {
<div className='flex gap-2'>
<Button type="submit" disabled={isLoading || !city.trim()} className="mt-4 w-full">
{isLoading ? <>
<Loader2 className="animate-spin w-5 h-5 text-white" />
<span>...</span>
@ -82,6 +85,7 @@ export function WeatherSearchForm() {
<span></span>
</>)}
</Button>
{currentWeather && (
<Button type="button" variant="outline" onClick={refreshWeather} disabled={isLoading} className="mt-4 w-full" title='刷新数据'>
<RefreshCw className={cn("w-5 h-5", isLoading && "animate-spin")} />

View File

@ -89,7 +89,7 @@ export const useWeatherStore = create<WeatherStore>()(
return{weatherCache:newCache}
}),
setLoading:(loading)=>set({isLoading:loading}),
setError:(error)=>set({error,isLoading:false}),
setError:(error)=>set({error}),
reset:()=>set({currentWeather:null,weatherCache:new Map(),isLoading:false,error:null}),
searchWeather:async(city:string)=>{
try{