fix(CourseDetailPage): 修复讲师列表和课程介绍的条件渲染
为讲师列表和课程介绍区块添加v-if条件渲染,避免数据为空时显示空区块 为讲师列表项添加底部间距,改善视觉效果
Showing
1 changed file
with
3 additions
and
3 deletions
| ... | @@ -28,7 +28,7 @@ | ... | @@ -28,7 +28,7 @@ |
| 28 | <!-- Course Main Content --> | 28 | <!-- Course Main Content --> |
| 29 | <div class="px-4"> | 29 | <div class="px-4"> |
| 30 | <!-- Course Details --> | 30 | <!-- Course Details --> |
| 31 | - <FrostedGlass class="mb-4 p-4 rounded-xl"> | 31 | + <FrostedGlass class="mb-4 p-4 rounded-xl" v-if="course?.introduce"> |
| 32 | <h3 class="text-lg font-bold text-gray-800 mb-3">本课程介绍</h3> | 32 | <h3 class="text-lg font-bold text-gray-800 mb-3">本课程介绍</h3> |
| 33 | <p v-html="course?.introduce" class="text-gray-700 whitespace-pre-line"></p> | 33 | <p v-html="course?.introduce" class="text-gray-700 whitespace-pre-line"></p> |
| 34 | </FrostedGlass> | 34 | </FrostedGlass> |
| ... | @@ -91,9 +91,9 @@ | ... | @@ -91,9 +91,9 @@ |
| 91 | </FrostedGlass> | 91 | </FrostedGlass> |
| 92 | 92 | ||
| 93 | <!-- lecturers Introduction --> | 93 | <!-- lecturers Introduction --> |
| 94 | - <FrostedGlass class="mb-6 p-4 rounded-xl"> | 94 | + <FrostedGlass class="mb-6 p-4 rounded-xl" v-if="lecturers.length"> |
| 95 | <h3 class="text-lg font-bold text-gray-800 mb-3">主讲老师</h3> | 95 | <h3 class="text-lg font-bold text-gray-800 mb-3">主讲老师</h3> |
| 96 | - <div v-for="(item, index) in lecturers" :key="index" class="flex items-center"> | 96 | + <div v-for="(item, index) in lecturers" :key="index" class="flex items-center" style="margin-bottom: 1rem;"> |
| 97 | <div class="w-16 h-16 rounded-full overflow-hidden mr-4"> | 97 | <div class="w-16 h-16 rounded-full overflow-hidden mr-4"> |
| 98 | <img :src="item?.photo || 'https://cdn.ipadbiz.cn/mlaj/images/default_block.png'" alt="lecturer" | 98 | <img :src="item?.photo || 'https://cdn.ipadbiz.cn/mlaj/images/default_block.png'" alt="lecturer" |
| 99 | class="w-full h-full object-cover" @error="handleImageError" /> | 99 | class="w-full h-full object-cover" @error="handleImageError" /> | ... | ... |
-
Please register or login to post a comment