11
This commit is contained in:
parent
984194ff7e
commit
fb3f257bbb
@ -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>
|
||||||
@ -195,8 +195,12 @@
|
|||||||
console.error('获取轮播图失败:', err);
|
console.error('获取轮播图失败:', err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
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',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user