diff --git a/pages/index/index.vue b/pages/index/index.vue index 065acb4..2683ef8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -39,7 +39,7 @@ - + {{weather.real}}° @@ -195,8 +195,12 @@ console.error('获取轮播图失败:', err); } }, - - getWeatherIcon(weather) { + + 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',