This commit is contained in:
Leo_Ding 2025-07-28 09:54:17 +08:00
commit 76660dd3f4
5 changed files with 7 additions and 3 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB