From fb3f257bbb6c35ecafeced50880751b9bad992ad Mon Sep 17 00:00:00 2001 From: qiuyuan Date: Thu, 24 Jul 2025 13:57:04 +0800 Subject: [PATCH] 11 --- pages/index/index.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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',