hookehuyr

fix(HomePage): 修复课程分类和已购标识的条件渲染问题

1 <!-- 1 <!--
2 * @Date: 2025-03-20 19:55:21 2 * @Date: 2025-03-20 19:55:21
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-11-11 16:29:22 4 + * @LastEditTime: 2025-11-11 17:18:13
5 * @FilePath: /mlaj/src/views/HomePage.vue 5 * @FilePath: /mlaj/src/views/HomePage.vue
6 * @Description: 美乐爱觉教育首页组件 6 * @Description: 美乐爱觉教育首页组件
7 * 7 *
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
208 已购 208 已购
209 </div> 209 </div>
210 <div class="absolute inset-0 bg-gradient-to-b from-transparent via-black/20 to-black/60 flex flex-col justify-end p-4"> 210 <div class="absolute inset-0 bg-gradient-to-b from-transparent via-black/20 to-black/60 flex flex-col justify-end p-4">
211 - <div class="bg-amber-500/90 text-white px-2 py-1 rounded-full text-xs font-medium inline-block w-fit mb-1"> 211 + <div v-if="course.category" class="bg-amber-500/90 text-white px-2 py-1 rounded-full text-xs font-medium inline-block w-fit mb-1">
212 {{ course.category }} 212 {{ course.category }}
213 </div> 213 </div>
214 <h2 class="text-2xl font-bold text-white drop-shadow-md">{{ course.title }}</h2> 214 <h2 class="text-2xl font-bold text-white drop-shadow-md">{{ course.title }}</h2>
...@@ -316,7 +316,7 @@ ...@@ -316,7 +316,7 @@
316 /> 316 />
317 <!-- 已购标识 --> 317 <!-- 已购标识 -->
318 <div 318 <div
319 - v-if="item.is_buy" 319 + v-if="item?.is_buy"
320 class="absolute top-0 left-0 bg-orange-500 text-white text-xs px-2 py-1 rounded-br-lg font-medium" 320 class="absolute top-0 left-0 bg-orange-500 text-white text-xs px-2 py-1 rounded-br-lg font-medium"
321 style="background-color: rgba(249, 115, 22, 0.85)" 321 style="background-color: rgba(249, 115, 22, 0.85)"
322 > 322 >
......