This commit is contained in:
qiuyuan 2025-07-24 13:57:04 +08:00
parent 984194ff7e
commit fb3f257bbb

View File

@ -39,7 +39,7 @@
<view class="weather-content">
<view class="weather-main">
<view class="current-weather">
<image class="weather-icon" :src="getWeatherIcon(weather.weather)" mode="aspectFit">
<image class="weather-icon" :src="weather.weather ? getWeatherIcon(weather.weather) : '/static/imgs/weather/default.png'" mode="aspectFit"></image>
</image>
<text class="current-temp">{{weather.real}}°</text>
</view>
@ -197,6 +197,10 @@
},
getWeatherIcon(weather) {
if (!weather || typeof weather !== 'string') {
return '/static/imgs/weather/default.png';
}
const weatherMap = {
'晴': '/static/imgs/index/sunny.png',
'多云': '/static/imgs/index/cloudy.png',